Gasoline has two problems when burned in car engines. The first problem has to do with smog and ozone in big cities. The second problem has to do with carbon and greenhouse gases.
When cars burn gasoline, they would ideally burn it perfectly and create nothing but carbon dioxide and water in their exhaust. Unfortunately, the internal combustion engine is not perfect. In the process of burning the gasoline, it also produces:
Catalytic converters eliminate much of this pollution, but they aren't perfect either. Air pollution from cars and power plants is a real problem in big cities.
Carbon is also a problem. When it burns, it turns into lots of carbon dioxide gas. Gasoline is mostly carbon by weight, so a gallon of gas might release 5 to 6 pounds (2.5 kg) of carbon into the atmosphere. The U.S. is releasing roughly 2 billion pounds of carbon into the atmosphere each day.
If it were solid carbon, it would be extremely noticeable -- it would be like throwing a 5-pound bag of sugar out the window of your car for every gallon of gas burned. But because the 5 pounds of carbon comes out as an invisible gas (carbon dioxide), most of us are oblivious to it. The carbon dioxide coming out of every car's tailpipe is a greenhouse gas. The ultimate effects are unknown, but it is a strong possibility that, eventually, there will be dramatic climate changes that affect everyone on the planet (for example, sea levels may rise, flooding or destroying coastal cities). For this reason, there are growing efforts to replace gasoline with hydrogen. See How the Hydrogen Economy Works for details.