White light coming from the sun contains all visible colors. This can easily be proven by using a glass prism, just like Newton did in 1665. But if it is white, why sky we see is blue?
Our eyes are able to see things thanks to their intercourse with rays of light. We see certain objects as red because they reflect red part of the visible spectrum, blue objects reflect blue, yellow reflect yellow, etc. Visible spectrum is the part of electromagnetic spectrum that our eyes are able to register.
We see this as a white light. When using aforementioned prism, we can dissolve the white light into all other colors starting with red, then orange, yellow, green, blue, indigo and violet. Our eyes are the most responsive to red, blue and green. The sky is blue because of the Tyndall effect.
This effect is explained by scientist John Tyndall in 1859. He conducted a series of experiments in which he discovered that when a ray of white light passes through a clear fluid in which small particles are suspended, the blue part of spectrum is scattered more then the red part of the spectrum.
The atmosphere around the Earth is full of tiny particles of dust and vapor and these act as a filter scattering the blue part of the spectrum in all directions. Since this scattering is random, some blue light ends up on Earth.
The red part of the spectrum has a tendency to pass through the atmosphere without much scattering, but during the sunsets, because rays of light create a smaller angle in relation to the horizon and they have a longer distance to pass through the atmosphere. Because of the longer distance, the red part of the spectrum gets scattered, and we see sky as red during the sunsets and sunrises.