About 20 miles above the Earth, the sky appears black. So what happens between there and here? Light, you might know, travels in waves. And the WAVES of different colors of light are different LENGTHS. Sunlight is a mixture of all those different colors. When the sunlight travels through the thickest part of the atmosphere, the short wavelengths of blue light get scattered. So what we see when we look at the sky during the daytime is the scattered blue light.
Answer provided by Dr. Universe