The sky appears blue to us because of the way that sunlight interacts with the Earth's atmosphere. When sunlight reaches the Earth's atmosphere, it is made up of a spectrum of colors, ranging from red to violet.
The gases and particles in the atmosphere scatter the sunlight in all directions. However, shorter blue wavelengths of light are scattered more easily than longer red wavelengths, because they are more easily absorbed by the gas molecules in the atmosphere.
As a result, when we look up at the sky during the day, we see blue light scattered in all directions, giving the sky its blue color. At sunrise or sunset, the sun is lower on the horizon and the light has to travel through more of the atmosphere to reach our eyes. This causes the blue light to be scattered even more, while the longer red wavelengths are able to pass through, resulting in the characteristic red and orange hues of a sunrise or sunset.
It's important to note that the sky can also appear different colors depending on atmospheric conditions, such as pollution, clouds, and even the time of day. However, the blue color we typically associate with the daytime sky is due to the scattering of sunlight by the Earth's atmosphere.