in the states the originated from mispronnounciations (sp?) as various cultures started mixing - say someone from Turkey comes over, and someone comes over from Norway, one from Russia, one from China - in each of their native languages, there are certain base ... fuck, I think they are called phenomes, but I might be off - they are the base sounds of the language.
for the most part humans in general only use a certain base set, and then there are variations off of that - but if you have grown up using only one subset of that, then it is hard to change - for instance the Brits tend not to say the "R", in China there is no "el" sound, hence why they have problems with it.
The accents come from people trying to learn english after learning anohter language first. Then as children are born into it, they aquire it b/c they pick it up from that around them.
In today's age where there are teachers that kids learn from instead of just their family, it introduces outside factors as well - hence why a child might have a different accent from their parents based on the region. There are regional sounds based on what various nationalities have lived there since America was started.
The better question is why do humans have varied languages - some look to the bible for answers to this, others to science. either way, it is an interesting field.