In essence, the engine is getting more fuel than it can burn cleanly.
This is because whne you put your foot down, the injection system supplies rather more fuel than is strictly necessary, just to get the engine to pick up speed ASAP.
Most diesels are now turbocharged, and this makes the effect even worse due to turbo lag. The turbo can't speed up fast enough to blow sufficient air into the engine to ensure a clean burn.
Petrol engines do it to, but to a far lesser extent, particularly now they are computer controlled (mecahnically controlled diesels are still very common on the roads). And exhaust from a petrol engine isn't as sooty as that from a diesel, anyway.