During the day (daylight) the sky has a blue appearance because the Sun’s light (white light) is made up of rainbow of colors (red, orange, yellow, green, blue, indigo and violet) of different wavelength. This means, all these different colors of light combine to give you what is called white light. When sunlight enters the Earth’s atmosphere, it collides with air particles that causes the scattering of sunlight around the sky. The light with the shorter wavelength is scattered more by this collision than light with longer wavelengths. In this case, violet light is scattered the most, but human eyes do not see this color very well. However, since the human eyes are more sensitive to blue light (the next most scattered visible color), you will see the sky as blue. This therefore means that the blueness of the sky is from the blue light that is scattered from the sunlight in the atmosphere which, then enters our eyes from all regions of the sky.
It is also important to note that, the moon does not give its own light but reflects the light from the sun. This reflected light from the moon is not strong enough to have the same effect (of blotting out the view of outer space) as the Sun.