The primary source of energy in the Sun and other stars is a process called nuclear fusion.
In the intensely hot and dense core of stars, light atomic nuclei are forced together and fuse to form heavier nuclei. For stars like our Sun, this predominantly involves the fusion of hydrogen nuclei (protons) into helium nuclei.
This nuclear fusion process releases a vast amount of energy. A tiny fraction of the mass of the fusing nuclei is converted directly into energy, according to the mass-energy equivalence principle described by Albert Einstein's equation $E=mc^2$. This energy radiates outwards, making the star shine.
Therefore, nuclear fusion is the correct explanation for the immense energy output of stars.