score:3
The question, as is, covers a long period between Alexander (d. 323 BCE) and Mahmud of Ghazni (b. 975 CE) and the ethnic and religious influence changed extensively over the period of more than a 1000 years.
So, I will focus on Gandhara during the early stages, immediately post-Alexander, and with particular emphasis on Buddhism (Gandhara was in the question title before subsequent modification).
Ashoka of Mauryan Emprire
Ashoka (son of Bindusara) would be the start of Buddhism in Gandhara. He was a significant emperor of the Mauryan Empire (322 BCE - 185 BCE). This period is much earlier than the Ghaznavid Empire (975 CE - 1187 CE).
Buddhism under Ashoka
The significance of Ashoka and Mauryan Empire to Gandhara, in terms of acceptance of Buddhism is on several levels:
Ashoka succeeded Bindusara as emperor in 270 BCE, while his son, Kunala, became the governor of Gandhara ...
source: The Grandeur of Gandhara (Algora Publishing, 2011)
Ashoka's Legacy
Ashoka's legacy is the spread of Buddhism, to Gandhara and the rest of the world - source:
He did with Buddhism in India what Emperor Constantine did with Christianity in Europe and what the Han dynasty did with Confucianism in China: he turned a tradition into an official state ideology and thanks to his support Buddhism ceased to be a local Indian cult and began its long transformation into a world religion. Eventually Buddhism died out in India sometime after Ashokaβs death, but it remained popular outside its native land, especially in eastern and south-eastern Asia. The world owes to Ashoka the growth of one of the worldβs largest spiritual traditions.
Upvote:0
The reason this was possible was because post Alexander, the Greek rulers of conquered territories got local leaders to accept their political dominance by taking on "local coloration," that is, adopting local customs and religious practices.
An example of this is the so-called Selucid Empire that dominated Asia Minor. The "culture" section of the link described how this came about.
In Egypt, the Ptolemaics became "more Egyptian than the Egyptians," even going so far as to adopt the local practice of royal incest (Cleopatra was forced to marry her younger brother).
Likewise, in India, the Greeks that reached the outer limit of Alexander's conquests "fused" with the locals, initially called "Bactrians." JAsia has produced a better answer about how the "conversion" to Bhuddism actually took place, but the important thing to note is that the Greeks (generally), were open to such conversions.