Because of Diffuse sky radiation
Diffuse sky radiation is solar radiation reaching the earth's surface after having been scattered from the direct solar beam by molecules or suspensoids in the atmosphere. Also called skylight, diffuse skylight, or sky radiation. Of the total light removed from the direct solar beam by scattering in the atmosphere (approximately 25 percent of the incident radiation), about two-thirds ultimately reaches the earth as diffuse sky radiation.
Scattering (also called scatter) is the process by which small particles suspended in a medium of a different index of refraction diffuse a portion of the incident radiation in all directions. In (elastic) scattering, no energy transformation results, only a change in the spatial distribution of the radiation. The science of optics usually uses the term to refer to the deflection of photons that occurs when they are absorbed and re-emitted by atoms or molecules.
The sky is blue partly because air scatters short-wavelength light in preference to longer wavelengths. Where the sunlight is nearly tangent to the Earth's surface, the light's path through the atmosphere is so long that much of the blue and even yellow light is scattered out, leaving the sun rays and the clouds it illuminates red, at sunrise and sunset.
Scattering and absorption are major causes of the attenuation of radiation by the atmosphere. Scattering varies as a function of the ratio of the particle diameter to the wavelength of the radiation. When this ratio is less than about one-tenth, Rayleigh scattering occurs in which the scattering coefficient varies inversely as the fourth power of the wavelength. At larger values of the ratio of particle diameter to wavelength, the scattering varies in a complex fashion described, for spherical particles, by the Mie theory; at a ratio of the order of 10, the laws of geometric optics begin to apply.
Individual gas molecules are too small to scatter light effectively. However, in a gas, the molecules move more or less independently of each-other, unlike in liquids and solids where the density is determined the the molecule's sizes. So the densities of gases, such as pure air, are subject to statistical fluctuations. Significant fluctuations are much more common on a small scale. It is mainly these density fluctuations that cause the sky to be blue.