Why is the sky blue and the sun yellow? The blue color of light of the sky is due to Rayleigh scattering.
But the sun itself appears yellow in color whereas the scattered sunlight itself appears blue.
Why does this happen?
Should the sun then not also appear blue in color?
 A: 
Raleigh scattering is very weak so the vast majority of the light from the Sun passes through the atmosphere without being scattered. That means when we look at the Sun we see the 99% of the light that isn't scattered, and that light has the original 5,700K colour spectrum.
The only light we see directly from the Sun is the light that travels in a straight line from the Sun to our eye - that's the horizontal yellow line in this diagram. If you consider the upper yellow line we can't see this light ray because it misses our eye. However the Rayleigh scattering due to the air scatters in all directions, so some of this scattered light reaches our eye. That means when we look away from the Sun we only see the scattered light and not the direct sunlight.
The Rayleigh scattering depends on the wavelength and blue light is scattered most. That means the light we see coming from directions away from the Sun has a spectrum weighted towards the blue. NB it isn't pure blue light. It's a spectrum of light enriched in blue compared to the direct sunlight. A spectrum of the scattered light from the blue sky is given in this answer:

(image from Wikipedia)
And that's why the Sun looks yellow and the sky looks blue.
