The sky appears blue (instead of black) because light passing through the air hits tiny particles like dust and pollen. These tiny particles are large enough to reflect blue light, but red light (which has a longer wavelength) is not reflected nearly as much. So the result is that the blue light gets scattered by the particles, and you see it when you look up.
The other side of this is sunset, when the sun appears reddish-orange low on the horizon. That’s because the light rays have to pass through a lot of air (and particles) before they get to your eyes, and all the blue light was scattered away and dispersed. That leaves only the red end of the spectrum to penetrate the atmosphere and reach your eyes.
At noon, the sun is coming straight down and only passing through ten miles of atmosphere or so. At sunset, the same light has to pass through many hundreds of miles of air to reach you. You will see more dramatic sunsets (redder and darker) when there’s a lot of dust, smoke or pollen in the air. When volcanic eruptions occur, intense sunset colours are seen around the world, sometimes for a couple of years after the event (as happened after Krakatoa. Ed.).
If the air is truly pure, it doesn’t scatter light much at all. If you climb up above the atmosphere or nearly to the top of it in an aeroplane, the sky appears black, not blue. If we had particle-free air, the sky would likewise appear black instead of blue. But we don’t.