If you take electricity coming from a solar panel and charge a battery, you can get ~90% efficiency. Simple and cheap. Instead, if you use that electricity to split water, separate the hydrogen with extreme purity, pressurize it to crazy levels (or, even worse, liquefy), transfer it to a giant (even in liquid form) hydrogen storage tank in the car and then recombine it with oxygen to generate electricity, you would be lucky to get ~20% efficiency. Expensive, complex, bulky and super inefficient. It loses on every dimension, including refuel time when pack swap is factored in.
Cost is bad for fuel cells, but that is only one of many bad dimensions. If fuel cells were in any way better than lithium batteries, they would at least be used in satellites, some of which cost over $500 million. They are not. - Elon Musk
Naturally Musk is going to be anti fuel cell technology for cars. When you actually look at the Infrastructure and other associated costs, things make a whole lot of sense. Ultimately, Hydrogen as a fuel source for personal vehicles is flawed.