Life as we know it is only possible with the help of carbon. Inside of all organic molecules is a carbon atom, and those atoms were forged in the center of massive stars.
An average star spends much of its life in the Main-Sequence, where it fuses hydrogen in its core to prevent it from collapsing upon itself. Those ionized particles combine and recombine to ultimately form helium. Our star has been, and will be, doing this for about four billion years.
Stars nearing the ends of their lives stop fusing hydrogen and instead burn the helium built up in their core. That produces heavier elements, namely oxygen and carbon. A tell-tale signature of carbon stars is the combination of those two elements. Oxygen combines readily with carbon into molecules, leaving a strong carbon signature in its atmosphere. In the sky, those stars burn ruby red.
So how does the carbon make it to the surface? Rather than bog you down with stellar nucleosynthesis, let’s skip ahead to the latter stages of a carbon star’s life. At this point, the two-to-three solar mass star has the puffed up atmosphere indicative of a red giant. The helium fusion taking place in a shell around the core is producing a carbon “soot” that envelops the outskirts of the shell. Convection currents from the stellar atmosphere travel deep enough to interact with that carbon layer, bringing the new atoms to the surface. There, the star’s gravity is rather weak, allowing the carbon (and carbon monoxide molecules) to be carried off by the stellar wind and out into the galaxy.
Even further along the star’s life, it will begin to form a planetary nebula. That is where large mass ejections form a huge sphere around the star. The nebula is enriched by the remaining carbon (and other metals) from the star’s atmosphere, in turn enriching the interstellar medium with those elements.
In 100 million years or so, a more massive star in our now-inert carbon star’s neighborhood will end its life in a supernova. The shockwave from the blast will compact the carbon-rich clouds enough to start stellar formation. A few million years after that, a protostar will have formed, surrounded by some gaseous orbs and rocky bits. Those rocky bits eventually coalesce into the terrestrial planets. Cometary ice condenses to form oceans which contain the beginnings of large organic molecules, molecules all constructed around carbon atoms.