Black holes can form when a massive star dies. Stars have a lot of mass which means there is a lot of gravity pulling in on the star. Gravity is the same force that keeps you on Earth so you don’t float into space!
These stars are also made up of very hot gas which lets off a lot of heat. This creates a force which pushes on the star from the inside out.
Normally the pull from gravity and the push from the heat balance each other out. But, as the star gets older, it burns up all of the fuel and there isn’t anything left to push out anymore. Now gravity takes over and all of the mass of the star falls in on itself into a single point. This is what we call a black hole.