
The temperature of a gas is a measure of how much energy it has. And the more energy it has, the more work it can do.
This is because heating gas particles makes them move faster, and they exert larger and larger pressure on the surfaces of their container
Higher pressure means the particles exert increased force. Until eventually, they are able to do work.
This is especially true for the very high temperatures generated in combustion. The more energy the air-fuel mixture has, the more force it exerts on the piston, and the more work the piston can do. That’s what happens during the power stroke.