Then elements up to Iron (no. 26 on the periodic table) came from supernovas, heavy stars that collapsed and exploded.
Actually, elements up to iron are mostly produced by massive stars through fusion in their cores before they supernova. Elements beyond iron are created in the supernova.
Our sun produces most of its energy through the proton-proton chain. However, stars that are larger than about 1.3 solar masses produce most of their energy through the CNO Cycle – involving carbon, nitrogen and oxygen. CNO Cycles are catalytic, that is, they use intermediate elements, but produce energy ultimately through the conversion of hydrogen to helium. However, the intermediates produced are heavier elements, which increase in concentration until a balance is reached, which depends on the mass of the star.
So very large amounts of heavier elements are produced during the life of the star, up to fluorine through the Cold CNO 3 and 4 chains.
In addition, stars have something called the triple alpha process, which can produce large amounts of carbon. Heavier stars also have the alpha ladder, which can produce elements all the way up to iron.
So all the elements up to iron can come from fusion in massive stars before they supernova. The reason for the supernova is that after they have fused elements up to iron, fusion comes to a halt. This is because the binding energy per nucleon peaks at iron, which means that fusing elements to create iron actually absorbs energy instead of producing energy.
A star is in equilibrium between the heat energy of fusion at the core trying to expand the star, and gravity trying to collapse it down. So when the creation of iron suddenly cools down the core, the expansive force is lost, gravity wins, and the star collapses under its own gravity. This is the supernova.
When the star collapses, the potential energy of all that collapsing matter is converted to heat, which drastically increases the temperature of the core far beyond anything it had seen while it was still a star. Now the temperature is high enough to fuse beyond iron, and this is how elements beyond iron are created. There is no upper limit here, depending on the mass, all the known elements beyond iron can be created in the supernova.
This tremendous surge of heat literally tears the star apart. After the collapse, the star explodes, leaving behind a small core and blowing most of its material into space, creating a nebula.
Heavier elements came from the Neutron stars, heavy stars that collapsed but didn’t explode.
No, neutron stars are the remnants of heavy stars that exploded.
Heavier elements came from the supernova, the explosion that occurred at the end of the star’s life when it tore itself apart. Neutron stars are the result of the explosion of massive stars.
To give you a concrete example, suppose a massive star of 20 solar masses is born. This star will quickly fuse its way through hydrogen, helium, beryllium, carbon — creating all these elements along the way until it reaches iron. Some nickle is formed too, which quickly decays into cobalt, which decays back to iron. At that point, there is no fuel left, so the star starts to collapse. This rapidly increases the temperature at the core until it hits 5+ billion C, at which point iron in the core fuses, absorbing massive amounts of energy. This rapidly accelerates the collapse, the star implodes. This is the supernova.
As the star implodes, all the potential energy of the outer layers of the star is converted to heat, as they fall towards the center. This creates very high temperatures at the core, which cause fusion and the production of heavier elements beyond iron. Theoretically, all elements on the periodic table can be created in this process, depending on the mass of the star.
The tremendous energy of the collapse tears the star apart. Most of it is blown out into space, forming the nebula. In a star that was originally 20 solar masses, you could have 10-18 solar masses worth of material blown out into space. The remaining material collapses to a small core under gravity. If this remaining core is over ~3 solar masses, it becomes a black hole. If it’s about 1.4-2.5 solar masses, it becomes a neutron star. If it’s below 1.4 solar masses, it becomes a white dwarf.
Now in addition to these mechanisms, which can create every naturally occurring element on the periodic table, there are other very energetic events happening in the universe, which can also create heavy elements. One of these is the collision of two neutron stars, as mentioned in the linked story. In this case, they studied a gamma ray burst of a type that indicated it was produced by a neutron star collision. The afterglow of the burst appeared to show that it came from the decay of higher atomic weight elements that had been created in the collision. Their guess is that some of those elements would have decayed to gold, hence the claim.