Most of the nuclei of atoms that make up our daily life were formed in the furnace of stars, and for others during violent stellar cataclysms.
Stars are formed from a cloud of material composed primarily of hydrogen. This cloud is contracting as a result of attraction due to gravity. The gravitational collapse of the cloud (called proto-Sun) heats the medium until the first reactions can "turn on", those which will convert hydrogen into helium. Then, other light nuclei are formed among them carbon and oxygen.
This is what the sun does since 4.5 billion years and will still do during about the same time. These fusion reactions release energy, which radiates some form of light and heat. The pressure of this radiation prevents the star from contracting further.
When the hydrogen fuel is exhausted, nothing precludes a new gravitational collapse. The temperature will rise even more until the new fusion reaction of nuclei begin until the production of iron (iron-56) isreached. Iron together with nickel-62 which is next to it , are the nuclide with the greatest nuclear stability. The ultimate fusion reactions that lead to iron can only occur within the central core of stars much larger than the sun.
Beyond iron, nature uses a different known mechanism to synthesize the heaviest nuclei (Gold , silver, lead, uranium). This mechanism occurs at the last stage of the life of very massive stars, which ends with an explosion. The star becomes very bright: a supernova.
The explosion seeded galactic space of stardust, containing heavy nuclei. Much later, this dust will condense with the interstellar gas to form new solar systems and in particular planets like our familiar Earth.
Access to page in french