Greece was a different country than Egypt.
Egypt was a united country. This means that there was one ruler (pharaoh) who ruled the whole country. All the people in Egypt felt that they were Egyptians, that they belonged to the same country. They spoke the same language and obeyed the same laws.
Greece was different. Because there are so many mountains, bays and islands, the Greeks did not have that much contact with each other.
So their cities developed separately. Each city had its own ruler, its own laws.
They were small countries as well as cities. That is why we call them: city-states.