Conceptually, replacing the current oil-based infrastructure with hydrogen would cost billions, maybe trillions, of dollars.
Although abundant in the universe, hydrogen is fairly rare in our atmosphere, meaning that it has to be extracted (for example through electrolysis, as explained above) and currently, the process is cost prohibitive and inefficient.
Its production at energy plants creates excessive carbon dioxide.
When it burns, a hydrogen flame is virtually invisible; coupled with the gas’s propensity for escaping, in small amounts, almost any tank, there are concerns about explosions. On the plus side, hydrogen is so light it typically is dispersed in the air very quickly.
On-board storage is a major issue; a hydrogen tank would currently be too large for a car.
It is a very flammable gas (think of the Hindenburg), which further adds to the on-board storage problems.