Sunlight while entering the earth encounters with the particles in the atmosphere. Particles in the atmosphere scatters the light of the sun.
The light with the shortest wavelength scatters the more. The blue and violet lights have the shortest wavelengths.
Thus the blue light scatters the more making the sky blue.