Evolution explains why *we* are here. What explains the elements?

Where did they come from? What did they form from? And what did that form from?

IANAPhysicist, but my understanding is that everything heavier than hydrogen formed inside of stars, through nuclear fusion. When the first generation of stars after the beginning of the universe (big bang or otherwise) died in spectacular ways (novas, supernovas, etc.), the heavier elements created by the fusion dispersed, to be recombined by new generations of stars and the planets that formed around them.

jayjay has got it. To be more specific:

Stars (like our sun) fuse hydrogen into helium. After awhile hydrogen gets scarce so the sun starts in on all the helium it has produced over the eons and fuses it into lithium(???..why am I thinking carbon instead?). Anyway, this process continues up the Periodic Table till you reach iron. Fusing iron into cobalt(?) however requires more energy than it releases. When the star gets to this point it really is nearly at the end of its life but nature still has a trick up its sleeve. When the star is about to die it either fades away with a wimper or goes out in the blaze of glory known as a supernova. The supernova provides tons more energy and compression which allows elements heavier than iron to form (and in significant quantities too). The supernova also scatters all of this stuff back into space where somewhere down the road it can all coalesce back into a planet and people and what not.

I’d like to ad that only the largest stars - the ones that usually end up as supernovas - have enough mass to produce elements such as iron. Our Sun, for instance, probably won’t form anything heavier than carbon.

You have to remember, though, that the larger a star is, the shorter its lifespan becomes (there is probably a whole bunch of red dwarfs that have been around since the formation of the galaxy), and so the process is much faster, and because stars tend to recycle - much more frequent.