Diesel and gasoline engines work very differently. They both are combustion engines but that is about it. For example, you don’t have spark ignition in diesel engines, they work on utilizing compression for combustion. Basically, the mixture of fuel and air is compressed at very high pressure and temperature that it explodes. Literally explodes. This is how the engine works, by harnessing the power of these controlled mini-explosions.
The peak temperature is much higher for diesel for obvious reasons and hence it returns a lot better fuel economy. Also, in gasoline engines the fuel and air mixture travels together into the engine usually through the carburetor, unless your car has an electronic fuel injection system. In a diesel engine, a pump pushes diesel under very high pressure into the engine through an injector. The opening of this injector is very thin as it has to “atomize” the diesel before it reaches the cylinder of the engine so that it burns faster and with greater efficiency.