This has been asked before here
A short answer is that sunlight has all the colors and our air acts like a prism that separates out the blue.