Heat and temperature

The quantity of energy available in the universe is a constant.
Thus a change in the energy of a system results in an equal and opposite change in the energy of its surroundings. 
Energy may be transferred between the system and surroundings as heat.
 
Heat (q) is the transfer of energy due to difference in temperature.
When two objects of different temperature are brought into contact with one another, heat flows from one to the other until they are in thermal equilibrium (have the same temperature).
 
As you know, when a hot and cold object are in contact, heat is transferred from the hot object to the cold object until they have the same temperature. Roll your mouse over the image.

The unit of heat is the joule (J).  This is the same as the unit of energy because addition or removal of heat is one way of changing the energy of a system.

The magnitude of increase in the energy of the system (due to heat being transferred to it) equals the magnitude of the decrease in energy of its surroundings. 
 
Note however from the image that q(surroundings) and q(system) have different signs.

The signs of the temperature change of the system and its surroundings are opposite to one another and depend on the direction in which heat flows.
The magnitude of the change in temperature of the system and surroundings are usually different.
 
This is because the temperature change caused by gain or loss of a certain quantity of heat depends on the mass and composition of the object changing temperature.