The creation of elements in the universe is a process called nucleosynthesis, and it primarily occurs within stars.
1. **Stellar Fusion (up to Iron):** Stars are powered by nuclear fusion in their cores. Initially, hydrogen nuclei (protons) are fused together under immense temperature and pressure to form helium nuclei. This process releases a vast amount of energy. In massive stars, as they age and their cores get hotter, they can fuse helium into carbon, carbon into oxygen, and so on, creating progressively heavier elements up to iron.
2. **Supernovae (heavier than Iron):** Fusion reactions that create elements heavier than iron do not release energy; they require energy. Therefore, these elements cannot be formed by the normal processes in a star's core. They are forged in the incredibly energetic explosion of a massive star, known as a supernova. The supernova provides the necessary energy to fuse lighter elements into the heaviest elements (like gold, silver, and uranium) and scatters all these newly created elements across the galaxy, where they can form new stars, planets, and life.