There is enough matter in a galaxy, that the matter within the galaxy is not affected by the expansion of the universe. You can think of this as the gravity of the galaxy holding it together, but really it's more fundamental than that. The rate of the expansion of the universe depends on the amount of matter (and dark energy) in the universe. If you just consider a tiny fraction of the universe which just includes a galaxy and total the matter in that region, it's more than enough to have already stopped the expansion in that region.
This page was last updated on June 27, 2015