The goal is to eventually produce hydrogen from water, through electrolysis. We have tech for this, but it's very expensive compared to our methane methods. Current electrolyzers are used for industrial applications. Spain is currently planning a huge deployment of electrolyzers to make ammonia, mostly for fertilizer.
And honestly, electrolyzed hydrogen will mostly be used in industry, and maybe some long-haul transport, but almost certainly will never make sense for cars. We will probably see hydrogen converted to methanol or ammonia or something else that's easier to handle than hydrogen. Though I do hear that hydrogen could be used with current ocean freighters with only a 10% loss of capacity, so there's some potential there.
Electrolysis is expensive and energy inefficient. It is unlikely to be a primary source of hydrogen unless there is some breakthrough.
If the limiting factor is clean electricity production, it makes sense to use it more efficiently with a BEV than it does to use it inefficiently with a HFCV.
Hydrogen is an essential industrial input and feedstock for many processes, including production of fertilizer in the form of ammonia. So we will be producing hydrogen for that, without a doubt.
It is estimated that by 2030 or so that electrolyzers will be as cheap as steam methane reformation (SMR), with or without carbon capture on the SMR. We will see if that prediction pans out! The IEA has put approximately 850GW of hydrogen production as a feasibly goal by 2030 as part of their plan for keeping climate warming at 1.5C, with half of that from electrolyzers. This may be fairly plausible, as Europe has mandated 40GW of electrolyzers by 2030, and there are currently 154GW of hydrogen electrolyzers in the pipeline:
https://www.rechargenews.com/energy-transition/growing-ambit...