In heat engines, heat energy is converted into mechanical energy.
A steam engine converts mechanical energy to heat energy.