If you take a can of cola from the refrigerator and leave it on the kitchen table, its temperature will rise- rapidly at first but then more slowly – until the temperature of the cola equals that of the room(the two are then in thermal equilibrium).
In generalizing this situation, we describe the cola or coffee as a system (with temperature TS) and the relevant part of the kitchen as the environment (with temperature TE) of that system. Our observation is that if TS is not equal to TE, then TS will change until the two temperatures are equal and thus thermal equilibrium is reached.
Such a change in temperature is due to the transfer of energy between the thermal energy of the system and the system’s environment. It may be mentioned that thermal energy is an internal energy that consists of the kinetic and potential energies associated with the random motions of the atoms, molecules and other microscopic bodies within an object. The transferred energy is called heat and is symbolized Q. Heat is positive when energy is transferred to a system’s thermal energy from its environment (we say that heat is absorbed). Heat is negative when energy is transferred from a system’s thermal energy to to its environment ( we say that heat is released or lost).
We are then led to this definition of heat:
“Heat is the energy that is transferred between a system and its environment because of a temperature difference that exists between them.”
Recall that energy can also transferred between a system and its environment as work W via a force acting on a system. Heat and work, unlike temperature, pressure, and volume, are not intrinsic properties of a system. They have meaning only as they describe the transfer of energy into or out of a system.
Let us now look into the Molecular Theory of Matter for an explanation of heat and temperature. Molecular Theory of Matter states that matter is made up of tiny particles called molecules. These particles are in constant motion within the bounds of the material. Since the relationship between kinetic energy of an object and its velocity is: KE = ½ mv2, which means that the more energy an object has, the faster it is traveling (or vice versa).
Thus, when you provide extra energy to an object, you cause its molecules to speed up. Those molecules, in turn, can cause other molecules to speed up. The sum effect of the speed or energy of these molecules is the phenomenon we call heat. Molecules can go into high-energy motion, causing heat, from various energy sources such as Light, Chemical reactions, Electrical resistance, Friction and nuclear reactions.
Heat is defined as "The total kinetic energy of all the molecules of a body" and temperature is a measure of “the average internal molecular kinetic energy of an object”.