
The sky is blue because of a phenomenon called Rayleigh scattering.
Sunlight contains all visible wavelengths. In vacuum, they travel together.
In the atmosphere, photons collide with nitrogen and oxygen molecules.
Shorter wavelengths (blue: ~450nm) scatter far more than longer ones (red: ~700nm).
The scattering intensity is proportional to 1/wavelength⁴.
Blue scatters ~5.5× more than red.
So blue light scatters in all directions across the sky. Red light passes through more directly.
At sunset, sunlight travels through much more atmosphere. Most of the blue has scattered away. Only red and orange reach you.
The same physics that makes sunsets red also makes the deep ocean appear blue, water absorbs red wavelengths, leaving blue to reflect back.