When massive stars with masses above the Chandrashekhar Limit reach the end of their lives, with all of their fuel having been consumed, they undergo a huge explosion which we call a ‘Core Collapse Supernova’.
This causes most of the outer layers of a star to be expelled and will leave behind just the matter from the inner core which, if there is enough mass, will very quickly form a Black Hole.
For this to happen, the Gravitational attraction from all the remaining matter needs to be larger than the repulsive force that holds it up.
In the star, this repulsive force comes from radiation pressure produced from the nuclear burning of fuel in the core.
In post-main sequence stars, such as ‘White Dwarfs’ and ‘Neutron Stars’, this force comes from trying to push all the sub-atomic particles together, such as electrons and protons to form neutrons.