Heat can be transferred through materials in three main ways. They are conduction, convection and radiation. In all three cases heat will always transfer from the hotter object to the cooler object.
Convection is when heat is transferred to molecules in the air or in liquid causing them to move up and down. Convection is the main way heat is transferred through liquids and gases. As liquids and gases are heated their molecules spread out more and the material becomes less dense causing it to rise. As it rises and cools down it will become more dense as the molecules get closer together and will then sink. The repeated rising and falling due to temperature causes convection currents.
Example: the bottom of a lake is colder than the surface or your basement is colder than the attic.