Specifically, small particles or gases in the atmosphere scatter sunlight which is at a longer wavelength (nanometers) than the particles. Since lower wavelengths of light are scattered more than longer wavelengths, blue, which is at the short wavelength end of the visible spectrum, is scattered more than the other colors that are at higher wavelengths. Therefore, we perceive blue scattered light in the sky more so than other visible colors that are scattered. This graphic representation shows the percent scattering of sunlight as it relates to the wavelength of light and blue has the largest area of the curve.
|Image by Robert A. Rohde|
Now if you are wondering why sunsets are red it is because the light that hits the Earth during a sunset is nearly tangent to the surface, creating a very long light path through the atmosphere. As a consequence, by the time the sunlight reaches the surface, most of the blue and green light has been absorbed or scattered out, leaving only red light.