Here main player is gravity. When a massive star(>3 solar masses) collapse due to end of it’s fuel,then outward pressure is lower than the inward gravitational force and it creates a black hole.
According to GR, space time curvature bends heavily in case of a black hole. Thus we see that when gravity wins over expansion force,that creates high density region of mass so that nothing can escape from it nor even light. It is called black hole.
Now,unlike gravity creates star, galaxy, cluster ,it ,creates also black holes. In center of every galaxy there is a supermassive black hole.
The relationship is better described as mutual sculpting — the galaxy feeds the black hole, and the black hole regulates the galaxy. It's a deeply coupled system, not a one-way preservation mechanism(by Cormendy and Ho’s research paper).
Image credit: vox