Electrolysis is horribly inefficient. It's so bad it's more economical to use natural gas to make the hydrogen.
There's a huge longstanding thread on
Hydrogen vs. Battery with all the gory details.
It takes a huge amount of energy to compress the hydrogen into a high pressure tank that can be carried by a car. That pumping energy alone is a good percentage of what an electric car would need to drive the same distance.
Hydrogen fuelling stations have to make the hydrogen on site because it's not practical to deliver it. So they can only fuel a couple of dozen cars a day.
Rolling out hydrogen infrastructure across the country would cost untold billions, whereas electricity is already everywhere and at most would require minor infrastructure enhancements. And plugs.
Hydrogen embrittlement is a big problem - it eats metal. All it takes to use the wrong alloy for one part and your refuelling station is a ticking time bomb. Yes despite the tiny number of stations in existence one has already blown up.
Hydrogen is incredibly flammable. It has the greatest range of concentrations that are flammable of any gas or vapor, by more than an order of magnitude. It also burns invisibly.
In order to store hydrogen in a car it has to be stored at crazy high pressures. This could be very dangerous in an accident or even if there is simply a failure.
Fuel cells are still very expensive, and require rare elements as catalysts. They're easily damaged by contaminants... things that you find in air for example.
Hydrogen cars still need batteries because the fuel cells can't provide much power for acceleration.
So hydrogen power is inefficient, expensive, and explosive. There are several technical breakthroughs that would be required to make it practical, and it's not even apparent that said breakthroughs are even possible.
So unless there are several miracles... hydrogen is the fuel of the future, and always will be.