Global warming is caused by an increase in the greenhouse effect. The greenhouse effect is not a bad thing by itself -- it's what allows Earth to stay warm enough for life to survive.
Although it's not a perfect analogy, you can think of the Earth sort of like your car sitting out in a parking lot on a sunny day. You've probably noticed that your car is always much hotter inside than the outside temperature if it's been sitting there for a while. The sun's rays enter through your car's windows. Some of the heat from the sun is absorbed by the seats, the dashboard and the carpeting and floor mats. When those objects release this heat, it doesn't all get out through the windows. Some is reflected back in. The heat radiated by the seats is a different wavelength than the light of the sun that made it through the windows in the first place. So a certain amount of energy is going in, and less energy is going out. The result is a gradual increase in the temperature inside your car.
The greenhouse effect is a little more complicated than your hot car. When the sun's rays hit the Earth's atmosphere and the surface of the Earth, approximately 70 percent of the energy stays on the planet, absorbed by land, oceans, plants and other things. The other 30 percent is reflected into space by clouds, snow fields and other reflective surfaces [Source: NASA]. But even the 70 percent that gets through doesn't stay on earth forever (otherwise the Earth would become a blazing fireball). The Earth's oceans and land masses eventually radiate heat back out. Some of this heat makes it into space. The rest of it ends up getting absorbed when it hits certain things in the atmosphere, such as carbon dioxide, methane gas and water vapor. After these components in our atmosphere absorb all this heat, they emit energy (also in the form of heat). The heat that doesn't make it out through Earth's atmosphere keeps the planet warmer than it is in outer space, because more energy is coming in through the atmosphere than is going out. This is all part of the greenhouse effect that keeps the Earth warm.