Hey you!
No one really knows why galaxies don't fly apart. Blackholes do, very strongly, have a gravitational pull on them, but that isn't enough to keep billions of stars and planets and other space matter in orbit around them. Although, the stars and gases are held together by the gravity of dark matter, so, you could say that explains why.
I Hope You Found This Helpful! :*)