In fact, hydrogen can actually be safer than gasoline. For one thing, hydrogen is a very light gas, and so if there is a leak, it tends to drift upward very quickly, even through tiny cracks in a roof, and disperse into the upper atmosphere where it is harmless. Gasoline is also very poisonous, so spills must be cleaned up at great expense to avoid poisoning ground water supplies. Finally, we have all seen the devastating effect oil spills have on natural habitats. This is one cause of smog in cities, and it is unhealthy for both humans and the environment in general.
Most scientists also believe that the burning of fossil fuels is causing global warming.
By generating electricity with solar power, or other renewable power sources like wind, and then storing it for use in a fuel cell, we can greatly reduce the release of carbon into the atmosphere, as well as our dependence on the Earth's finite supply of oil. To solve this problem in the past, systems have used large banks of batteries, but these batteries have limited storage capacity, are very heavy, may use toxic chemicals, and must be replaced every few years. When hydrogen gas is burned, although it does not produce carbon monoxide or carbon dioxide like fossil fuels, the high temperatures involved in the process form Nitrous Oxide, an air pollutant. This means that you get a lot more power for the same amount of hydrogen, and there is no noise from the process. Also, fuel cell generators may have a longer lifespan than combustion engines.