If you were thinking ‘One of the gods made them all in a great heavenly forge’, you’re actually closer than you think.
Science can’t say whether divinities were actually involved, but, as it turns out, nothing much besides Hydrogen (element #1) forms on its own. EVERYTHING else gets cooked up in the hearts of the great heavenly furnaces, the stars.
As most people know, stars are powered by nuclear fusion. A huge clump of Hydrogen is compressed under the strain of a terrifically powerful gravitational field, and, at a certain point, something gives. The Hydrogen atoms start getting squished together, and are forced into a new element, Helium.
But where do those elusive ‘heavy’ elements come from?
When a star starts running low on Hydrogen, it will begin ‘burning’ the Helium too, forming even heavier elements. Unfortunately for stars, this is a process of diminishing returns – each new elemental fusion yields less energy than the previous. At a certain point, depending on the star’s mass, this process grinds to a halt, and the star can go no further.
If this star is small, like our sun, it will eventually burn out, keeping its horde of atomic treasure all to itself.
If it is a bit bigger, though, it will get really, really angry. In a fit of rage, it will tear itself asunder in one of the most dramatic and powerful events in the known universe. It will explode in a Supernova.
Such is the explosive energy unleashed during a Supernova event that even the poorest grade of fuel, the middle-weight elements like Iron, aren’t safe from atomic infusion. Brief though the blast is, compared with the life of the star, a Supernova packs enough power to force the creation of Uranium, and even more dense (and more unstable) elements.
The blast is also powerful enough to eject these ultra-dense atoms out into the surrounding cosmos. This is our present suspicion as to how Uranium, along with all the other heavy elements, came to be present on Earth. Our forming Solar System probably passed through the thick gaseous corpse of a fallen giant star, where, like greedy pirates, our swirling vortexes of proto-planethood snatched up all the nuclear treasure from the debris field that they could get their grubby little gravitons on.
Of course, we humans can also create heavy elements ourselves, with the aid of particle colliders and other advanced technology. However, we could never build a more efficient crucible for the distillation of these protonic presents than the original matter conversion factories themselves, the brilliant heavenly bodies that illumine our darkest nights – our stars.