In simpler and more immediately relevant terms,..
...most lorries ("trucks") use diesel because it's more efficient and cheaper, and most cars use petrol ("gas") because diesel engines are -- or at least, used to be -- heavier, weaker, and louder.
This is in turn a consequence of the different ignition types, as Andrew points out. Basically, since petrol/"gas" is volatile and easy to ignite, a carburator (or nowadays usually a fuel-injection system) mixes (vapourised, is that the correct term?) fuel and air in the intake manifold, the mixture is inhaled into the cylinder, compressed, and ignited by an electric spark. Diesel, being less volatile, wouldn't ignite that way. In stead, pure air is inhaled, compressed to a *much* higher degree than in a petrol/"gas" engine, and only then is the diesel fuel injected directly into the cylinder, and ignites from the compression heat.[*] These higher compressions, and the higher pressure generated by the quicker and possibly more energy-dense combustion, require the diesel engine to be built much more robustly than a petrol/"gas" engine. Therefore it is much heavier per kilowatt/horse-power generated, or weaker per kilogram/pound of weight, and that's the main reason why it hasn't been used in cars as much as in lorries/"trucks" and buses, etc.
About the environmental aspect, yes, diesel engines tend to be more "sooty" than petrol/"gas" engines... But I wonder, isn't there just as much dirt in petrol/"gas" -- only it's not as conveniently clogged together into particles for a filter (or the cilia in your throat and nose) to pick out? Aromatic hydro-carbons are aromatic hydro-carbons, I'd think...
The interesting story behind the new(-ish) generation of "TDI" engines Tony mentions is that in a way, they aren't so new at all. Long, long ago (in the 1950's? Earlier?), companies -- mainly Daimler-Benz, but also Peugeot and probably a few others -- set out to do something about the noise (and to some extent, the weight) problem(s). Their solution was the pre-chamber and the swirl-chamber (or "vortex chamber"? Sorry, I'm translating from the German 'Vorkammer' and 'Wirbelkammer' here.), which are basically small compartments in the cylinder head, connected through a narrow channel to the combustion chamber in the cylinder. (The pre-chamber is a simple shape, and the swirl-chamber assymetric, kind of helix-shaped, so as to induce in the fuel-air mixture inside it.)
You see, in a petrol/"gas" engine, you get a "flame front" proceeding in an orderly fashion (OK, except the whole process happens thousands of times per minute... :-) from the spark plug, giving you a gradual burn of the fuel -- in these engines, actual "detonation" is considered a fault. In the original diesel engine, OTOH, that's SOP, business as usual -- and that's exactly what gives diesel engines their characteristic "harsh" sound. So these European (not to say German) engineers designed engines where the fuel is first injected into these little chambers, where it can't all detonate at once because there simply isn't room for enough oxygen in there. In stead, *some* of it ignites immediately, and it all travels through the channel out into the main combustion chamber, where more and more of it ignites as it encounters more and more oxygen.
This kind of diesel engines is what has been used in cars from at least the 1970's, possibly/probably earlier, up until about now. It has some downsides, of course: The cylinder heads become bulkier and more expensive to manufacture because you have to cast these additional more or less intricate shapes into them. And above all, there are friction losses in the interconnecting channel; the diesel engine loses some of its vaunted fuel efficiency to the pre-chamber. Therefore, lorries/"trucks", buses, tractors and just about everything else eschewed this design, continuing to _inject_ their fuel _directly_ into the combustion chamber... You see where I'm going with this?
Yup: "Direct Injection" is really just a fancy way of saying "we dropped the pre-chamber and went back to Rudolf Diesel's original design." :-) This reversal in basic design was made possible by the developing auxuliary technology; as Tony says, more refined injection pumps. As I understand it, they can now achieve the "softer burn" effect by injecting the fuel gradually, in stead of all at once. In case this seems backwards to you, a la "Why the heck couldn't they do that before?", let me remind you of the immense pressures required. ISTR reading somewhere that car diesel-injection pumps generated something like 1,100 to 1,300 bar, and this was before the (even higher-pressure) TDI generation[**]. Heck, it was a great achievement that they were gas-pedal-adjustable at all, in stead of just running at a single fixed speed!
[*]: There have also been various hybrids, like lamp-oil ("petroleum"?) motors that ignited off a "glow-ball" that was heated with a blowtorch before starting, and the Swedish Hesselman motor that was started on petrol/"gas" and then switched over to fuel oil, and the electric ignition switched off (IIRC).
[**]: I *do* recall me Dad tellin me about some bloke who, while trying to diagnose and fix a lorry engine, put his finger over the end of an injection pipe and called to his pal, "Crank 'er a few times, so I can see if this pipe is blocked!"... Drilled a hole right through 'is fingertip, Dad claimed.
Christian R. Conrad
Of course, who am I to point fingers? I'm in the "Information Technology" business, prima facia evidence that there's bats in the bell tower. -- [link|http://z.iwethey.org/forums/render/content/show?contentid=27764|Andrew Grygus]