Nebulae look careless. The physics behind them is anything but. Each glowing cloud is the visible record of a star that has spent its entire life arranging the periodic table with obsessive discipline, then ejecting those elements in phases that set up the next generation of suns and worlds.
First comes scarcity, not abundance. A massive star burns hydrogen into helium in its core through nuclear fusion, then stacks heavier layers of carbon, oxygen, silicon and iron in an onion-like structure described by stellar evolution theory. When the core can no longer gain energy from fusion, gravitational collapse triggers a supernova, an event whose shock waves drive explosive nucleosynthesis and fling those freshly minted atoms into the interstellar medium.
The debris is not a featureless fog. Fast iron-rich ejecta plow into slower outer shells, setting up Rayleigh–Taylor instabilities that sculpt filaments and knots, while ultraviolet radiation from the remnant star ionizes hydrogen and oxygen into the familiar red and green emission lines of H II regions and planetary nebulae. Dust grains condense from cooled carbon and silicon, forming silicates and graphite that later act as condensation nuclei inside molecular clouds.
What looks like chaos is a supply chain. Supernova remnants seed surrounding gas with precise ratios of heavy elements, raising metallicity until gravity can collapse enriched clouds into protoplanetary disks, where accretion and disk chemistry lock those atoms into rocky crusts, iron cores and volatile atmospheres. Without that staged sequence of core burning, shock-driven mixing and radiative shaping, a galaxy would have light, heat and little material from which to build a planet that can ask how it arrived.