Here's why:
* Hotter stars emit more blue light: The hottest stars emit a lot of blue and ultraviolet light, making them appear blue-white.
* Cooler stars emit more red light: Cooler stars emit more red and infrared light, giving them a reddish appearance.
Think of it like a piece of metal heated in a fire. As it gets hotter, it changes color from red to orange to yellow to white, and eventually a blue-white glow. The same principle applies to stars!