Why did ancient Greece advance differently compared to earlier civilizations in Egypt, Mesopotamia, China, and Indus valley?
In a sense, every civilization is unique, and so all civilizations advance in different manners from other civilizations.
The first major Greek-speaking civilization, the Mycenaean one, was quite similar to neighboring kingdoms of Mesopotamia and Egypt, in being a monarchy, having a syllabic alphabet, having a polytheistic religion, and developing monumental architecture. The collapse of Mycenaean civilization led to the formation of a more fissiparous civilization in classical antiquity.
One distinct feature of Greece is geography, with small fertile areas divided from each other by mountains that make land travel difficult. That meant that from an early age, Greek civilization had a maritime orientation. Also, this geographical setting led to the development of city-states or "poleis" as integral political units, rather than the creation of vast empires.
The Athenian democracy was a direct outgrowth of the small size of the polis. Direct democracy of the Athenian type would not have been possible in larger states with ancient technology; there was simply no way a larger nation could fit all its free males into a single assembly space and have them discuss political measures and vote.