Stars and Energy
The first source of a star's energy is the force of gravity. Stars are so massive and the pressure at the interior so great that the atoms in the core are stripped of their electrons. Since most of the atoms are hydrogen atoms, the nuclei are a bunch of protons. The protons heat up under the incredible pressure at the core and crash into each other. Every so often, protons briefly turn into neutrons and then back to protons. If a crash occurs just in the right instant, when one of the protons is a neutron, the proton and neutron stick together. The combined proton and neutron collide and stick with another proton, then two of those particles combine to create a helium nucleus --- two protons and two neutrons --- releasing two extra protons in the process. Every fusion step releases energy. That's fusion energy, and it's the energy source for every star, at some point in its life.
Aging Stars
As a star gets older, it runs out of fuel. It runs out of hydrogen in the core, and the energy output from the core decreases. There's less energy pushing out from the core, so the star shrinks. But the shrinking heats the shell of hydrogen that surrounds the helium core, making the hydrogen shell burn more. That adds more helium to the core, increasing the temperature and pressure in the core until it's hot enough to burn helium. The helium burns and turns into carbon. Carbon is the organic element. For stars smaller than about one and a half times the mass of the sun, this is the last stage of their existence. Hydrogen and helium stop burning and the carbon core cools down.
Bigger Stars
Larger stars can continue their fusion. Because the stars are more massive, their core reaches even higher pressures and temperatures, high enough to push carbon nuclei together to create even heavier atoms. The cycle continues, creating atoms as heavy as iron. Then the star stops burning, and collapses at an incredible rate. The collapse is resisted by other forces when the core gets very dense, and the star "bounces" out in an incredibly powerful explosion --- a supernova. The explosion has enough energy to fuse even iron atoms, so as the star explodes it releases a wide array of elements into space. But the energy is too great to allow these elements to combine into molecules; so even though carbon, oxygen and hydrogen are present in the star, they are all in their elemental forms.
Organic Compounds
Carbon, hydrogen and oxygen all are ejected into space during various phases of a star's existence. Within stars they cannot combine into molecules --- the temperatures are too high to allow molecules to stay together. In the clouds of materials ejected by stars, however, the temperature is low enough to let molecules stay together. The question is, are the clouds dense enough to let the atoms "find each other" and combine? Recent evidence, such as that gathered by the National Radio Astronomy Observatory in 2008, indicates that organic molecules are created within the thin, gaseous clouds that spread through interstellar space.