Why is the sky blue?

Because the Earth's atmosphere scatters the light of the sun, and blue light scatters more readily than other colors in the spectrum, we tend to see the sky as blue.

Light can be affected by the medium it passes through. For example, a prism separates white light into a spectrum of colors, and a mirror reflects the light entirely. When it passes through the atmosphere, light gets scattered. If unimpeded, the light of the sun is white.

Blue light has a shorter wavelength than other colors of light, and it scatters more easily. It is this scattering which makes it perceptible to the human eye.When the sun starts to set, the light is passing through even more atmosphere, and yet further colors are visible (such as orange and red).

You can read more at https://spaceplace.nasa.gov/blue-sky/en/, where I researched this answer.