Molecules vibrate. Molecules that have just two atoms vibrate by simply moving closer together and then further apart. The nitrogen (N2) and oxygen (O2) molecules in the animation are vibrating in this simple mode.
Molecules with 3 or more atoms can vibrate in more complex patterns. A single molecule can vibrate in various ways; each of these different motions is called a vibration "mode". Carbon dioxide (CO2) molecules have three different vibration modes, as illustrated on the right side of the animation.
Molecules with more (and more complex!) vibration modes are more likely to interact with passing waves of electromagnetic radiation. This is why carbon dioxide absorbs and emits infrared (IR) radiation, while nitrogen and oxygen molecules do not. This ability to absorb infrared waves is what makes carbon dioxide a greenhouse gas.
Water vapor (H2O) and methane (CH4) molecules also have vibration modes that cause them to interact with passing IR waves. As you might expect, methane and water vapor are also greenhouse gases.