We now know that the gypsies originated in the Punjab in northwestern India, fleeing from the region during the clashes between invading Arab and Mongolian warriors, a thousand years ago. On their long odyssey, they travelled through, and settled in, the countries of the Middle East, including Persia and Egypt. Those who moved on from Egypt cultivated the legend that they were descendants of the Pharaohs, a belief to which many of their songs still refer. They also settled in Turkey, then known as Egypt Minor, and it was either their association with Egypt itself or this "other" Egypt that they became known as Gypcians. In old Spanish, in any case, gitano was simply a way of saying Egyptian... Those who had been in Greece were, in like manner, called Graecians. But in fact, because they had no writing, they had forgotten where they really came from.
An excerpt from the essay, "My Friends, the Gypsies" (on the "Andalucia" web site)