Why is the blue star hotter?
When a star is blue it means it is putting out light mostly in the ultraviolet spectrum which is of a higher energy than infared light, or light in the visible spectrum. This means the star has more energy and heat.
a blue star is hotter then a red star because it is younger and thus has more energy. a good example of this is when you look at a flame on a lighter you see blue light at the bottom because blue is hottest and closest to the heat source whereas the red-orange flame at the top is farther away from the heat source and thus is not as hot as the blue.
Generally a blue star is on the main sequence. However, the colour of a star is related to its temperature. It's temperature is related to the mass of the star - the higher the mass (Size) the hotter the star is. A star on the main sequence [See related question] is fusing hydrogen into helium to produce energy.
The peak wavelength of a star's radiation is proportional to its surface temperature. (Actually to T4, but the concept is sound.) -- So a star with a relatively cooler surface radiates a spectrum that peaks at a lower wavelength than that of a relatively hotter star does. -- A relatively cooler star might peak in the red, or even in the infrared. And a relatively hotter star might peak in the blue, or even…