The simplest answer is because the Ptolemaic dynasty made it the capital, and thus gauranteed that the largest share of products, resources, and money that the court and related bodies used and distributed flowed through there. This is the same reason that cities like Rome and Constantinople grew so large. Supporting a large city in the ancient world required the mobilization of a great deal of resources to direct into that city's population. The court of the Ptolemies did just that. It was not unusual for formerly large cities to quickly depopulate once the resources that supported them no longer existed; this was the case for Babylon for example, as the centre of power in Mesopotamia moved to Antioch and then Ctephion.
In addition, it's location on the Mediterranean sea gave it easier access to these resources as well as the larger Greek world, which compared to the location of older Egyptian capitals along the interior on the banks of the Nile, gave it superiority in attracting the influx of Greek traders and settlers that would come to dominate the city.