A star's energy comes from the combining of light elements into heavier elements in a process known as fusion, or "nuclear burning". The helios project Britannica and NASA.
It is generally believed that most of the elements in the universe heavier than helium are created, or synthesized, in stars when lighter nuclei fuse to make heavier nuclei. The process is called nucleosynthesis. Nucleosynthesis requires a high-speed collision, which can only be achieved with very high temperature.
The minimum temperature required for the fusion of hydrogen is 5 million degrees. Elements with more protons in their nuclei require still higher temperatures. For instance, fusing carbon requires a temperature of about one billion degrees! Most of the heavy elements, from oxygen up through iron, are thought to be produced in stars that contain at least ten times as much matter as our Sun.
Our Sun is currently burning, or fusing, hydrogen to helium. This is the process that occurs during most of a star's lifetime. After the hydrogen in the star's core is exhausted, the star can burn helium to form progressively heavier elements, carbon and oxygen and so on, until iron and nickel are formed. Up to this point the process releases energy. The formation of elements heavier than iron and nickel requires the input of energy.
Supernova explosions result when the cores of massive stars have exhausted their fuel supplies and burned everything into iron and nickel. The nuclei with mass heavier than nickel are thought to be formed during these explosions.