Updated: Oct 16, 2020
Short Answer: When white light from the sun hits and passes through our atmosphere during daytime, the blue component of sunlight scatters more so than the other wavelengths.
As a result, our atmosphere is sort painted in that wavelength making it seem like the sky is blue.
If you want a deeper understanding read on:
So first of all, we need to understand that the sun produces electromagnetic radiation. Within this radiation we have visible light, ultraviolet light, radio waves, X-rays, infrared, etc. You may be interested to know that although the sun does create gamma rays, it does not emit it.
Getting back to topic, we should only be concerned with the visible light spectrum to answer this question. The visible spectrum of sunlight consists of wavelengths that are visible to the human eye. The collection of all these visible wavelengths is referred to as white light since it appears to be white. If we find a way to separate this light, say using a glass prism, we can see that white light separates into different colors. Each color has a distinct wavelength. The separation shows a range of shorter wavelengths corresponding to colors like violet, blue and green; increasing to a range of longer wavelengths corresponding to colors like orange and red.
We also know that the sky is not always blue. When the sun is setting, the sky around the sun appears to be red or orange. When it is rising it may appear to be pink. At night the sky is dark with specks of light from distant stars scattered around. From this observation we can deduce that the sky is not inherently blue or orange or pink. It must be the light from the sun that is painting our atmosphere. It makes sense because blue, orange and pink are colors that are part of sunlight. Furthermore, at night there is no direct sunlight but weak amounts of sunlight reflected off of the moon. Therefore, the night sky is dark. But why does the sky appear to be only blue most of the time when there a many different colors in sunlight?
So for the sky to be painted in shades of only one color , there must be some sort of separation happening similar to that of a glass prism. This leads to the question, 'what is causing the separation?'. It must be the atmosphere since it is the only barrier that exists between us and the sun. The atmosphere is actually reflecting and disturbing certain wavelengths while allowing others to pass through. The blue wavelengths of light are the shortest relative to the other colors in sunlight. These shorter wavelengths have greater difficulty passing through the small gaseous molecules in the atmosphere. The longer wavelengths have no trouble since they are larger than the molecules and pass right through the atmosphere. But blue light wavelengths are very small; therefore, it keeps on being reflected and scattered around the atmosphere before reaching our eyes.The other longer wavelengths (green, red, etc) just pass straight through and reaches our eyes as white light without separating or scattering.
As a result, each ray of sunlight or white light will generate multiple rays of blue light when it comes into contact with the atmosphere. Each of these blue rays will scatter around and reach our eyes from several different points in the atmosphere. Each of these points that are spread across the atmosphere will appear blue to us. When you scale this to account for all the sunlight in contact with the atmosphere you can see that the entire atmosphere is basically saturated with blue rather than any other wavelength.
Depending on the time of the day, the sky may appear less blue and more red especially around the sun. For example when the sun is setting and rising, the sky around the sun appears red or orange. This is because in these cases the sun is situated lower in the sky. Sunlight has to travel through a thicker atmosphere before reaching us. This means that a lot more of the blue wavelengths and wavelengths of colors closer to blue like green are also scattered and less of it reaches our eyes. Now that more of the shorter wavelengths are deflected, the light that passes straight through no longer appears white. It appears to be in shades of yellow and orange since these are the only wavelengths passing through unscattered.
Higher levels of pollution could further propagate this to make it seem like the entire sky is a dark red or orange. This is because there are more molecules of different contaminants and gases in a polluted atmosphere. These molecules have a range of sizes; some are large while some are small. As a result there is more disturbance to a wider range of wavelengths rather than just blue. Therefore, only the larger wavelengths of colors like orange and red can pass through unscattered. This orangish red light strikes clouds and paints the entire sky in a beautiful warm color.
The color of the sky depends on the position of the sun in the atmosphere and how polluted the atmosphere is. Therefore, the answer to the question is: The sky is blue because blue wavelengths of light are more prone to scattering and spreading across the sky before reaching our eyes.
Hope you learned something new!