The sun is a big ball of super-heated gas that generates as much energy every second as all the power plants in Earth could produce in about 2 million years. The sun gets its enormous energy through fusion, a nuclear reaction that joins together the nuclei of atoms. Fusion takes place deep inside the sun at temperatures of 27 million degrees Fahrenheit. Fusion converts hydrogen to helium and releases energy, which makes the sun very bright and able to give off so much light and heat.
SOURCE: TIME Book of Why.