Here's why:
* The Sun emits a spectrum of light: The Sun is a giant ball of hot gas, and it emits radiation across the entire electromagnetic spectrum, including visible light.
* Blackbody radiation: The Sun's light distribution follows a curve known as a blackbody radiation curve. This means that the peak of the curve is in the yellow-green region, but the Sun still emits significant amounts of light in the blue and violet ranges.
* Scattering: The Earth's atmosphere scatters shorter wavelengths of light (blue and violet) more than longer wavelengths (red and orange). This is why the sky appears blue during the day.
However, the Sun's light is actually more white than yellow. The yellow hue we see is due to the way our atmosphere scatters blue light.