Earlier I said in a post about cosmological theory that heavy elements originated when our universe was young. I didn’t research it enough I was wrong about that. There is a concept called stellar nucleosynthesis which says the necessary building blocks of life and inorganic matter come from stars. Here are some excerpts from various online articles.
The documentation and history of star formation is here: http://en.wikipedia.org/wiki/Stellar_nucleosynthesis
On the nucleosynthesis page, one will find a picture of a cross section of a red giant showing nucleosynthesis and elements formed.
Some stellar history.. Population III (the oldest) stars were hot massive stars containing no heavy elements. They would have burned very intensely, emitting intense ultraviolet light, which would have ionized the neutral hydrogen gas around them. They would have burned out rapidly, in the span of a few million years, ending their brief lives in intense supernovae blowing new heavier elements such as carbon, silicon, oxygen and iron into other collapsing gas clouds, seeding those forming stars with these new elements. This marks a trend in star composition. Older stars contain less heavy elements in them to start with, while newer younger stars are formed from a higher proportion of heavy elements. These stars are said to have a higher metallicity. All the elements heavier than hydrogen, helium and a tiny amount of lithium come from fusion reactions inside stars and from the debris left over after they die and explode.
Formation of basic elements three seconds after the Big Bang: Protons and neutrons came together to form the nuclei of simple elements: hydrogen, helium and lithium. Fast forward another 300,000 years for electrons to be captured into orbits around these nuclei to form stable atoms.