Why do galaxies have so many stars?

Galaxies are giant cities of stars held together by gravity over billions of years.