i don't know how all of them came about, but i know that in the middle ages they started using last names to tell what you did for work. like if you worked with metal, you would of course be called 'black' for 'blacksmith' and if your last name was copper, you worked with copper. and also, some of them were to show you who was your father. like johnson, means son of john. jackson means son of jack, and so on. hope it helps!