When atoms of the two gasses hydrogen and oxygen are put next to one another, they spontaneously combine to form water. This combination results in the release of a lot of energy and lets an electron loose temporarily. In a fuel cell, the hydrogen and oxygen are separated by a membrane. The membrane captures the free electrons during the chemical reaction that forms water, which in turn powers anything hooked up to the fuel cell. It also releases some heat.
Fuel cells are a remarkable power source.
Refueling a fuel cell means providing more hydrogen and oxygen. Or, as they did in the Apollo missions, you can drink the water. Fuel cells have been in use in the space program for a long time. They went up with the first Apollo astronauts since they could last longer than traditional batteries and didn't have any expensive radioactive parts. Unfortunately, fuel cells are very heavy and it takes a fair amount of propulsion fuel to place one into space.