Weather is caused by the movement or transfer of energy. Energy is transferred wherever there is a temperature difference between two objects. There are three main ways energy can be transferred: radiation, conduction and convection.
The Earth receives and absorbs energy from the Sun in the form of electromagnetic radiation (mostly light and ultraviolet energy). The Earth also re-radiates a lot of heat back to the atmosphere and into space (as infrared radiation). Within the atmosphere however, a lot of energy is transferred by convection, which drives much of the world's weather. Convection involves the movement of air.
Greenhouse gases in the atmosphere keep the Earth's surface much warmer than it should be. Greenhouse gases let in sunlight energy but trap infrared heat energy trying to escape back to space. This process is called the natural greenhouse effect. Man-made pollution may be enhancing the natural greenhouse effect and causing global warming.