Energy from its outer layers compresses its core. The only thing that can make a stars core collapse is a collision with another star. Massive stars develop iron cores that cannot fuse anymore, so the core collapses under gravity; usually creating a supernova or blackhole depending on the mass of the star