The sky is blue because air molecules scatter blue light more than red light.
Sunlight looks white, but it’s actually a mix of every color, each with a different wavelength. As that light passes through the atmosphere, it collides with nitrogen and oxygen molecules far smaller than the wavelengths of light itself. This kind of collision, known as Rayleigh scattering, scatters shorter wavelengths — blue and violet — far more strongly than longer ones like red and orange.
Violet light is actually scattered even more than blue, but the Sun emits less of it and human eyes are less sensitive to it, so the sky reads as blue rather than violet. The same scattering effect explains why sunsets turn red: when sunlight travels through more atmosphere at a low angle, most of the blue light gets scattered away before it reaches your eyes, leaving the longer red and orange wavelengths to dominate what you see.