The sky is blue because of **Rayleigh scattering** — the way sunlight interacts with air molecules.
Sunlight contains all colors (wavelengths) of visible light. When it enters Earth's atmosphere, it collides with gas molecules (mostly nitrogen and oxygen). These molecules scatter light in all directions, but they scatter shorter wavelengths (blue, violet) much more strongly than longer wavelengths (red, orange) — about 10× more.
So blue light gets scattered across the entire sky, while red/orange light passes through more directly (which is why sunsets are red — light must travel through more atmosphere at a low angle, scattering away all the blue).
Fun fact: violet light is actually scattered even more than blue, but our eyes are less sensitive to violet and the Sun emits less violet, so we perceive the sky as blue.