“The Sun is a mass of fiery stone a little bit bigger than Greece,” said Anaxagoras in 434 BC. Actually, it is a ball of mostly hydrogen gas held together by its own gravity and big enough to swallow a million Earths. Because the ball rotates at different speeds at different latitudes, its magnetic field becomes horribly twisted. Eventually, it snaps like an elastic band, and the pent-up energy is unleashed in “flares”, which can be seen as whorls on this image taken by ESA/NASA’s “Solar and Heliospheric Observatory” (SOHO). SOHO highlights regions at about 1 million degrees.The Sun
The Sun captured by ESA/NASA's 'Solar and Heliospheric Observatory'

But, in the heart of the Sun, the temperature is around 15 million degrees. Here, the “nuclei” of atoms of the lightest element, hydrogen, slam together and stick to make nuclei of helium, the second lightest element. The by-product is sunlight. This process is so inefficient that, on average, it takes two hydrogen nuclei 10 billion years to find each other and stick. It is because of this that the Sun will burn for about 10 billion years, providing enough time for the evolution of complex life like us.

To give you some idea of how inefficient is the Sun’s heat generation, imagine your stomach and a region in the heart of the Sun the same size and same shape as your stomach. Your stomach generates more heat. So why is the Sun hot? Simples. Because it is made of an unbelievably large number of chunks the size of your stomach all stacked together.