Black holes are formed when massive stars die and their cores collapse under the force of gravity. When a star runs out of fuel to burn, it no longer has the energy to push back against the force of gravity that's trying to collapse it.
The outer layers of the star are blown away in a supernova explosion, while the core collapses in on itself. If the mass of the core is greater than about three times the mass of the sun, the force of gravity becomes so strong that nothing can stop the collapse, and a black hole is formed.
The boundary around a black hole beyond which nothing can escape is called the event horizon. This region is defined by the Schwarzschild radius, which is proportional to the mass of the black hole. Anything that crosses the event horizon is swallowed up by the black hole, including light. As a result, black holes appear as completely black regions in space.