The air is composed mostly of nitrogen and oxygen molecules. These molecules are made up of two atoms each, sort of like two little weights attached by a spring. Because of the springiness of the forces holding the two atoms together in a molecule, the atoms may vibrate relative to each other. According to the rules of quantum mechanics, only certain vibrations are allowed. If the energy of the light, which is a form of electromagnetic radiation, arriving at the molecule from the Sun is just enough to bump a molecule from a small vibration to a larger one, then the radiation may be absorbed by the molecule and released later. While the molecule holds this energy it is said to be in an excited state. It is blue light that happens to have the right energy for this interaction with the molecules of the air.
The tricky thing here is that the direction of the radiation released from an excited molecule is not necessarily the same as the direction in which it was traveling when it was absorbed. So blue light which came from the Sun to the Earth's atmosphere in a straight line gets absorbed and released in any old direction, possibly going through the process many times before bouncing into your eye. That is why blue light seems to be coming from all over the sky, giving the sky that blue color. Other colors not subject to this scattering seem to be coming from the Sun.