The timing belt or chain in your car's engine keeps the opening of the valves properly timed with the motions of the pistons so they don't interfere with each other. To understand how it works and why, it may help to review how the typical four stroke engine works. All modern overhead cam motors have a timing chain or a belt, as do most pushrod, cam-in-block motors, but some engines use a system of gears, or even a shaft with bevel gears on either end to connect the cam and crankshaft.
For a four stroke engine to operate, the valves have to open and close in precise time with the pistons moving up and down. To simplify things, the camshaft which operates the valves rotates at half the speed of the crankshaft. A toothed timing belt, or timing chain, turns on toothed pulleys or sprockets, to keep everything indexed properly for millions of rotations and tens of thousands of miles. Gears were the original way to key these two shafts together, but they quickly gave way to chains because they were much more flexible when designing the motor, not to mention lighter.
Ideally, an engine would be designed so that no matter what, the pistons could not hit the valves and cause catastrophic damage, but larger valves, high lift cams, high compression rations and shallow combustion chambers combined to leave little room for error. A "non-interference" engine has plenty of room for all the parts, and in the case of a broken timing belt (or the engine "losing time" some other way) there is no internal damage. In an "interference" engine the opposite is true, and it is imperative that you change the timing belt and check the tensioner at the proper intervals to avoid costly engine damage.
Whether the engine is an interference design or not, if you buy a used car with no service history the timing belt should be on your short list of required maintenance. If the car or truck has a timing belt and more than 50,000 miles it is living on borrowed time.
Timing chains largely replaced gear-driven timing systems (or sometimes shaft and bevel gear systems), because they were easier to package, lighter and more efficient. Then through the 1970s and 1980s chains were themselves replaced in many application by toothed timing belts, which were silent and required no lubrication like a timing chain does. However, the timing chain has come back strong in the 21st century because of its longer life expectancy and more compact size; Some DOHC cars like the Plymouth Laser and Dodge Neon needed hood bulges to clear the cam pulleys.
Timing chains are very durable and can easily last the life of the motor in modern cars. In the old days of pushrod motors with much shorter cam chains, No tensioner was used and the chains would easily last 100,000 miles. Worn timing chains retarded the valve and ignition timing (since the distributor also turned off the cam) affecting performance and emissions, but still ran fine. The worst damage to a modern timing chain equipped OHC motor is typically caused by cracked plastic chain guides and tensioners contaminating the oil or getting caught in the chain; this is a particular worry with some Audi V6 motors, with multiple timing chains.
Timing chains tend to give much more warning before they ultimately fail or jump time. The chains stretch slightly over the course of use, and a worn timing chain or failing tensioner will also emit a rattling noise. Timing belts tend to simply snap, which can cause damage in an instant, as valves stuck open at the wrong moment hit the top of the rising piston. Such damage can destroy an engine completely, or lead to a multi-thousand dollar repair bill, hence the increasing popularity of the timing chain. Timing belts can also be ruined by a leaking oil seal at the crankshaft, as the oil can soften the rubber and cause the teeth to tear and the belt to slip.