How were the elements heavier than iron created?
Broadly, the answer is nuclear fusion during the deaths of millions of stars.
The question is phrased the way it is because, in nuclear energy terms, iron is a very stable atom. In fact, it is the most (atomically speaking) stable of all the elements. You need to think about the periodic table of the elements to understand the question. The periodic table lists all the elements in terms of the number of protons in their nuclei. Hydrogen (element no 1) has one proton. Iron, element no 26, has 26 protons, while Uranium, element no 92, has 92 protons.
The question asks where all the elements with atomic numbers of 27 and more came from. And the question is important because conventional nuclear physics kind of stops you from making anything with an atomic number greater than 26. Read the following geeky stuff for an explanation of why it is hard to make those heavier elements. Or skip it if you trust me to explain it kinda OK.
Geek stuff
When the physicists want to talk about nuclear reactions, they rely either on nuclear fission, in which big, heavy unstable atoms (like uranium) get split into smaller, but more stable atoms, with the release of some energy. Or they talk about nuclear fusion, in which two light atoms (like hydrogen), merge together into one heavier atom, with the release of more energy.
So heavy atoms are unstable, and can be split with the release of energy, and light atoms are relatively stable, but if they are forced to merge, they also release lots more energy. The key number to look at here is the binding energy, which is the energy required to keep all the protons and neutrons together inside an atomic nucleus.
If you want to do some modern-day alchemy and change one type of atomic nucleus into another type, then the sums all work out, except for this binding energy. It turns out that the difference in binding energies is what gets released in your tokamak (or nuclear pile). If the binding energy of the ingredients is less than the binding energy of the resulting products, then you have yourself a reaction which gives off energy (and usually lots of it).
Somewhere back in the early 1900s people looked at binding energies and found that iron has the highest binding energy of them all, which means that no matter what you do to a lump of iron in your tokamak or nuclear pile, it's going to suck a load of energy in before it'll become anything but base metal.
Iron is the nemesis of the modern-day alchemists. You can't do shit with it. (except make steel and build bridges and make swords and other boring stuff).
On the whole, nature is pretty cool about energy, it doesn't really like doing things which suck in energy, or which use the stuff in a silly way. Converting iron into gold is an *extremely* silly way to use energy, and not nearly as lucrative as it might sound.
End of Geek stuff
So to find places where nature gets a bit silly and actually does some alchemy, where iron really does change into gold and other atoms, we need to look at places where there is so much energy floating around that this kind of 'uphill' process is not only possible in a theoretical sense, but might actually happen.
First place to look at is a hot, hot star. And when we look there, we find that, although there is a pile of energy floating around, it is all being used in pretty sensible ways. Nature has not gone silly enough to play alchemist in a star. All the nuclear processes going on there are sensible and normal and running down the energy curve, starting with hydrogen and ending up with iron, making other atoms, like carbon and aluminium along the way. (see CapnTrippy's write-up for a full explanation).
As the star ages, it uses more and more of its nuclear fuel and goes through less and less lucrative reactions (in energy terms) Until, eventually, it can't make enough energy through normal nuclear fusion to keep itself inflated. When that happens, the star implodes. Falls in on itself. And when that happens, there is a truly gigantiferous release of energy: gravitational energy. All the billions of tonnes of star stuff falls into the centre from a height of millions of kilometres, and the amount of energy released is just silly. There is simply so much energy coming into such a small space in such a short time, that nature goes mad and quite happily wastes it on stupid reactions like converting iron into gold (and uranium and other heavy atoms). The sheer amount of energy involved means these reactions can happen without any problem at all. They just cool things down by a tiny fraction as they soak up some tiny portion of the available energy.
If things carried on in a kind of steady way, then those mistakes would get corrected and all the high energy products would eventually get converted back to iron. But things don't carry on in a steady way. The release of energy is so spectacular that the star now blows itself apart, (manifested as a nova or supernova) and all the waste products fly apart into the cold depths of space, and eventually freeze. There is no longer enough energy around to bring the exotic results of nature-gone-silly gracefully down the binding energy curve to boring old iron. The new elements just sit there, waiting for gravity to make them clump together into a planetesimal.
That's where Earth came from. Once, a few billion years ago, a star blew up. The remnants: hydrogen, helium, carbon, oxygen, nitrogen, iron, silver, gold and uranium, travelled through space for millennia, until they clumped together under the influence of gravity, and some became the sun, others became planetesimals, which then formed into the planets we know today.
It is also why, on Earth at least, any element with an atomic number greater than 26 is rare compared with anything with atomic number equal or less than 26. The lighter elements: hydrogen and helium, float away in the atmosphere. The Earth's gravity was not strong enough to hold them in place. Iron lies at the core of the planet, having sunk there when the earth was hot. But the elements heavier than iron remain rare on this planet, and throughout the universe.