Black holes form due to a gravitational collapse of an object such as a star. When a star has used up all its fuel and therefore cannot maintain the high temperature the internal pressure of the star cannot withstand it’s own gravity. Think about you holding your hands together and pushing out while someone else puts their hands on the outside of yours and pushes in. When you run out of energy you can no longer push out and so the person pushing in makes your hands collapse. This is similar to what happens with a star.
If the mass of the collapsed star is big enough it can form a black hole in which the gravitational pull of itself is so big it distorts time and light around it.