Why do diesel engines deliver more torque than gasoline engines?
A gas engine compresses a fuel-air mixture and then ignites it with a spark. A diesel engine compresses just air, to such a high pressure and temperature that when fuel is then injected, it ignites automatically with no need for a spark. This is the fundamental difference between the two engines.
...so, a diesel engine has to do more compression than a gas engine does, to get the fuel to ignite. Conversely, a gas engine cannot do as much compression as the diesel engine does, because the fuel-air mixture it is compressing would ignite too early, at the wrong moment. Remember the diesel engine just compresses air, so it doesn't have that problem.
...so, the piston in the diesel engine has to travel further, in order to compress the air more. So the piston stroke is longer in a diesel engine.
...and, a longer piston stroke means a larger diameter crankshaft. Assuming the force coming from the gas piston and the diesel piston is equal, then the diesel piston has a longer lever arm and is turning its crankshaft with greater torque (but, necessarily, at fewer revolutions per minute). The gas piston may be delivering the same power, but it is delivering it by turning a crankshaft at more revolutions per minute, with less torque.
In fact, the diesel engine burns up the fuel a bit more efficiently, and diesel fuel has a bit higher energy content than gasoline, so a diesel piston should actually deliver more power from burning the same volume of fuel. But this is less important than the above argument in explaining the torque difference.
If and when you do want less torque and more speed, or more torque and less speed, than your engine is naturally inclined to give you, you can get it by gearing the engine up or down. That's why cars have gears, and why big trucks have lots of gears. But of course, in any of various senses of the word "free", transmissions don't come free.