When / how did it begin?
I wrote my Senior Thesis on a topic similar to this. My thesis was that the Greco-Persian relationship during the times of the Peloponnesian War became one of the first examples of racism, or "othering" of a distinct culture.
As you may know Herodotus wrote the definitive history of the Greco-Persian Wars and, despite its many flaws, maintained a fairly unbiased look towards Persian culture and achievements (I think this history could almost be considered anthropology or sociology, as large portions of the history are spent describing various cultures in the region.) However following the defeat of the Persians, and the subsequent Peloponnesian Wars, Greek authors began to recast the Persians as somehow different (barbarians), and the foundation of Western freedom and liberty, versus Eastern autocracy and subjugation began to take form.
These authors were most likely trying to put an end to the infighting between the Greeks, and, since the Persians were already an historical enemy, they provided a great target.
Now, this could be seen more as xenophobia than actual racism, but it was clearly the beginning of a divide that has not been overcome even today.
You should check out this book: http://press.princeton.edu/titles/7737.html The Invention of Racism in Classical Antiquity, by Benjamin Isaac. It's quite interesting and provides a lot of primary source material.