A heat engine is a device that converts thermal energy into mechanical work by exploiting the temperature difference between a hot and a cold reservoir. It operates in cycles, absorbing heat from the hot reservoir and expelling some of it to the cold reservoir while performing work.