One of the basic truisms in astronomy is that, when a massive star ends its life, it goes out with a bang. A big one. A supernova.
This titanic explosion is triggered when the star runs out of nuclear fuel in its core. The core collapses in a heartbeat, and the energy generated in that collapse is so immense that it blows the outer layers off. This explosion is so colossal, it can outshine an entire galaxy! In the meantime, the collapsed core can form an exotic neutron star, or may even squeeze itself down into a black hole.