Here's why:
* Sun-like stars are main sequence stars: They fuse hydrogen into helium in their cores, generating energy and pressure that balances gravity.
* Red giant phase: When a star like the Sun runs out of hydrogen fuel in its core, it expands and becomes a red giant. This is because the core contracts, heats up, and starts fusing helium into carbon.
* Planetary nebula: As the outer layers of the red giant are ejected, they form a planetary nebula (though it's not related to planets).
* White dwarf formation: The remaining core, composed mostly of carbon and oxygen, becomes a white dwarf. It is extremely dense and hot but gradually cools down over billions of years.
Important Note: While a white dwarf is the most likely outcome for a Sun-like star, there's a small chance it could become a neutron star if it experiences a supernova. This is more likely for stars slightly more massive than the Sun.