How does oil transfer energy?

The hydrocarbon molecules in petroleum contain a large amount of chemical energy. When they are burned, two things happen: they release a lot of that energy as heat, and they release gases (carbon dioxide, water vapor and sometimes nitrogen, depending on the fuel).

The heat energy may be used directly, as in a furnace or water heater, or it can be converted into mechanical or electrical energy by means of a boiler and steam turbine.

The pressure of the hot gases that are released may be used to drive reciprocating machinery, such as a piston engine, or to drive a gas turbine, such as a jet engine.