Some say it's due to the blue oceans.
Some think it's what's in the atmosphere
(mostly nitrogen and oxygen).
Some believe it's because outer space is blue.
But truthfully, it has to do with the size of the particles in the Earth's atmosphere.
They are considered "small" particles (much less than 1 nanometer across).
These small particles scatter sunlight as it passes through.
Sunlight contains all visible colors of light, and more.
In the 1870s, a man named Rayleigh found that each color (or wavelength) of light is scattered to a different degree.
Here's the amount each color is scattered when the sun is directly overhead...
More blue light than other colors is scattered out of the sunlight traveling through the atmosphere.
This creates a diffuse blue glow, and makes the sun appear yellow in color.
When the sun is lower in the sky, sunlight travels a longer distance through the atmosphere to reach an observer.
This means it encounters more particles that scatter out most of the blue light, as well as some green and yellow light. This leaves mostly red light when the sunlight reaches the observer.
Well, there you have it.
The sky is blue because Earth's atmosphere contains small particles that scatter more blue light than other colors.