This is done by nuclear fusion in which it converts hydrogen atoms into helium. so the byproduct of nuclear fusion is that in the sun's core is a massive volume of energy that getting release and radiates outward towards of the surface of the sun and into space to the solar systems and a bit beyond. that's kinda all I know hope it helps. =^-^=