Fuel cells generate electricity by combining hydrogen and oxygen gases. Hydrogen flows through an anode, splits into protons and electrons, and generates electric power, with water as the by-product.. Hydrogen flows through an anode, splits into protons and electrons, and generates electric power, with water as the by-product.