Sunlight comes in to the atmosphere and warms the ground and oceans (it does not directly warm the air). The warmed ground and oceans then heats the air by contact and the warm air rises, passing the warmth right through the air.
Some gases in the air can soak up a lot of heat. They are water vapour (that will eventually make rain), carbon dioxide (which is produced by people, animals and burning fossil fuels) and methane, a gas produced by plant-eating animals as a result of chewing their food.
The greater the amount of these gases in the air, the warmer the air will eventually become. So as we burn more fossil fuel like coal, oil and gas, and keep more animals like cows, the air is likely to get warmer.
Because the air warms, it is often likened to the way a greenhouse works and so is called the Greenhouse Effect.