If you think about something that is very hot, like a cup of coffee, and you put it on a room temperature table does it stay hot when you come back to get it after an hour or two? Objects want to reach equilibrium and that includes thermal equilibrium. As the coffee sits out the heat (which is the transfer of energy) leaves the coffee and is taken in by the room temperature table the coffee sits on. If you lifted the coffee the spot it was just on would be a little warmer than the rest of the table and the coffee would be warm but, not hot. If you waited another two hours, the coffee and the whole table would be the same temperature because the heat was lost to the environment, in this case, the surrounding air.

For two objects at different temperatures, the hotter one will lose heat to the cooler one until they attain thermal equilibrium - i.e they have the same temperature. Assuming there is no heat lost to the surroundings, the total energy lost by the hotter one is equal to the energy gained by the cooler one - measured by the equation Q = mc. (where Q = energy, m = mass of object, c= specific heat capacity, and delta t is change in temperature)