How does the Sun produce energy?
The Sun's main energy source is nuclear fusion in its core. Converting hydrogen nuclei into helium releases energy associated with a mass difference. The Sun does not burn by consuming oxygen like an ordinary fire; its energy production is not chemical combustion.
Energy from core to surface
High core temperature and density enable fusion, with quantum tunneling also essential to the nuclear reactions. The proton-proton chain dominates in the Sun. Energy travels through a radiative region and then a convective outer region. A core photon should not be imagined as one unchanged beam reaching the surface; energy undergoes many absorption and re-emission interactions.
Balance and the star's future
The balance between inward gravity and pressure determines stellar structure. The Sun evolves gradually rather than switching off suddenly when fuel changes. It lacks enough mass to end in a core-collapse supernova. Spectra, solar oscillations, and neutrino measurements test models of its interior. Its visible surface temperature must not be confused with the much hotter core where fusion occurs.