The sun burns due to a nuclear fusion reaction that leads to the release of heat and light energy. It may seem paradoxical to some students that the sun can burn in space, an environment without oxygen, but it is burning thanks to a fusion reaction rather than combustion, so oxygen is not required for the sun to produce heat and light as if it were fire. Technically, the sun is not on fire as such but is a burning ball of nuclear fusion reactions.
The nuclear fusion reaction that fuels the sun's constant inferno is known as a proton-proton chain reaction. This type of reaction happens at a molecular level, and given that the sun is so large, that means that there are countless numbers of tiny reacting molecules within the sun at all times. Specifically, hydrogen atoms are being converted into helium, and the byproducts of this reaction are light and heat. Collectively, all of the molecules that make up the sun produce enough light and heat to cause the hot summer days that can be experienced on Earth, which is many millions of miles away from the sun. However, although the sun is quite large, these reactions only take place in the inner 25 percent of the star, which is known as the sun's core.