Scattering is the phenomenon by which a beam of light is redirected in many different directions when it strikes minute particles in the atmosphere.
The light from the Sun has to travel a long distance of the Earth's atmosphere before reaching us. As light travels through the atmosphere, it gets scattered in different direction by the air molecules present in its path. The blue light due to its short wavelength is scattered more as compared to the red light of longer wavelength. Thus the light reaching our eye directly from sun is rich in red colour, while the light reaching our eye from all other directions is the scattered blue light. Therefore the sky in direction, other than the direction of sun, is seen blue.
OR
At the time of sunrise, the blue colour of sunlight is scattered more due to smaller wavelength while passing through the thicker layers of the atmosphere. The red colour of longer wavelength is scattered a little, thus giving us a red appearence of the sun.