Heat is one form of energy and Mechanical energy is another form of energy. Work is done when physical characteristics (quantities) of a substance change, like pressure, volume, shape, velocity, state etc.
During 19th century, the conversion of energy into other other forms and principles of conservation of energy and thermodynamics principles were developed. For that the concept of mechanical equivalent of heat was used.
Mechanical equivalent of Heat is the amount of work done by a substance after absorption of the heat, provided that there is no heat transferred to the environment (ie., there is no loss of energy).
This concept was used by the famous scientist Joule.
Suppose you heat a gas at the same pressure P, the gas expands from volume V1 to V2.
The mechanical equivalent of heat given to the gas = P (V2 - V1)