Really, why? After all, the Sun sends to the Earth with rays of white and vozeh transparent. Why is the sky that we see in clear weather - blue?
And the fact that the rays of the Sun have to break through the atmosphere - air shell of the Earth. And the air, though transparent, but it is not emptiness. Air is composed of different molecules, contains water vapor and dust particles. When the light meets these microscopic particles, they dissipate. And I must say that white light is not easy. It consists of several colors - red, orange, yellow, green, blue, blue, purple. Yes, imagine if we combine these seven rays of color, we will get a white ray of light!
Multi-colored stripe, which represents the decomposition of white light into its component parts, is called the spectrum. Look at him - he remind you of?

Well, of course, a rainbow!
Air particles most strongly scatter the blue part of the spectrum. Because we as the sky is blue.
See also:
What color is the sky on the other planets of the Solar system?
What is a rainbow?