The examination of the relationships between chemical reactions and energy
changes is an aspect of chemistry called thermochemistry.
(or energetics)
Thermochemistry looks at performance of work (which has a
slightly different meaning in science), expenditure or consumption of
energy by chemicals, and flow of heat between different
chemical species.
For example, work must be performed to compress a gas or to separate particles
of opposite electrical charge (such as an electron and a nucleus).
Chemical processes such as the burning of gasoline release energy in
the form of heat.
Chemical systems perform work and transfer heat, which
essentially boils down to inter-conversion and/or changes in kinetic and potential
energy of the
substance(s) involved.
The broader topic of the study of energy and its
transformation is known as thermodynamics,
of which thermochemistry is only a small sub-topic.