Hydrogen fuel is a battery. Energy from other fuels is used in its production. Natural gas and petroleum are batteries, the source of energy was ancient sunlight stored in plants and such...etc.
I tell my college students all the time in lecture. “Fossil fuels” are nothing more than stored ancient sunlight. It takes well over a metric tonne of algae or diatoms settled to the ancient seafloor buried under at least 2km of additional sediments and put through the petroleum window of time,pressure and temperature to create one US gallon of petrol. The actual number is closer to two metric tonnes of organic matter to one US gallon of hydrocarbons. I teach geology from time to time at University for extra cash and to help out an alma mater if they are short a lecturer.