When something is heated, heat is being transferred from one part of a substance to another, or from one body to another. When water is heated, heat is being conducted from the heat source (burner) through the metal pot, to the water. Heat is energy in transit, this means that heat always flows from a substance at a higher temperature to the substance at a lower temperature. This is why warm things warm up cold things (like a hot water bottle on a cold foot) and not vice versa.
The Conservation of Energy
It was through experiments that Joule developed the idea that energy in any one form could be converted into any other. There might be a loss of useful energy in the process – for example, some of the heat from the furnace of a steam engine is lost up the chimney, and some more down the exhaust – but no energy is destroyed. The work done by the engine added to the heat from lost as described and the heat developed as friction, it is equal to the heat provided by the fuel burnt. The idea underlying this statement is the Principle of the Conservation of Energy. It implies that, if we start with a given amount of energy in any one form, we can convert it in turn in all other forms; we may not always be able to convert it completely, but if we keep an accurate balance sheet we shall find that the total amount of energy, expressed in any one form (for example heat or work) is always the same, and is equal to the original amount.
The conservation of energy applies to living organisms (i.e. plants and animals) as well as to inanimate systems. For example, we may put a man or a mouse into a box or a room, give him a treadmill to work, and feed him. His food is his fuel; if we burn a sample of it, we can measure its chemical energy, in heat units. And if we now add up the heat value of the work, which the man does, and the heat, which his body gives off, we find that their total is equal to the chemical energy, which the man eats.