Fuel cells produce electricity by utilizing the power generated by electrochemical reactions and convert potential chemical energy into electrical and heat energy. They use external sources of chemical energy, such as hydrogen and oxygen, to produce energy. Electrochemical reactions in the fuel cells oxidize hydrogen, which reacts with oxygen to form water, releasing electrons that flow through the external circuit as electric current.