This is composite image of planetary nebula NGC 2392, from the Chandra X-ray Observatory. It’s an older star, that has used up all of the hydrogen in its core – and begun to cool and expand, increasing its radius by tens to hundreds of times its original size.
Eventually, the outer layers of this star will be carried away by a fast stellar wind, which will leave behind a hot core. This hot core has a surface temperature of about 50,000 degrees Celsius, and is ejecting its outer layers in an even faster wind. The radiation from the hot star and the interaction of its fast wind with the slower wind creates the complex and filamentary shell of a planetary nebula.
At some point, the remnant star will collapse to form a white dwarf star.
Our sun will become a planetary nebula about 5 billion years from now.