Sunlight looks white but is actually every color mixed together. When it hits the atmosphere, air molecules scatter the shorter, bluer wavelengths far more strongly than the longer red ones — an effect called Rayleigh scattering, where scattering rises sharply as wavelength shrinks. So blue light bounces around the sky in every direction, and that scattered blue is what reaches your eyes when you look up away from the sun.
At sunset the light travels a much longer, slanted path through the atmosphere. By the time it reaches you, almost all the blue has been scattered away and only the reds and oranges survive the trip — which is why the sun and the clouds near it glow warm. The same wavelength-dependent scattering, running in reverse geometry, produces both the midday blue and the evening red.