It is the heat of the compressed air that lights the fuel in a diesel engine. In the simplified animation above, the green device attached to the left side of the cylinder is a fuel injector . The injector has to be able to withstand the temperature and pressure inside the cylinder and still deliver the fuel in a fine mist. Getting the mist circulated in the cylinder so that it is evenly distributed is also a problem, so some diesel engines employ special induction valves, pre-combustion chambers or other devices to swirl the air in the combustion chamber or otherwise improve the ignition and combustion process. One big difference between a diesel engine and a gas engine is in the injection process.
Most car engines use port injection or a carburetor rather than direct injection.
In a car engine, therefore, all of the fuel is loaded into the cylinder during the intake stroke and then compressed. A diesel compresses only air, so the compression ratio can be much higher. The higher the compression ratio, the more power is generated. When a diesel engine is cold, the compression process may not raise the air to a high enough temperature to ignite the fuel. Glow plugs are rarely used today on larger engines.