“Energy density” generally refers to the volumetric energy density, where hydrogen is one of the worse methods of storing energy. Hydrogen has the best “specific energy density” or gravimetric energy density, IF it is compressed. You should include both if you want to be accurate.
This is why hydrogen has lost when it comes to cars. Hydrogen has pretty bad energy density to start with, and then you’ve got to store it in cylindrical tanks which is hard to integrate efficiently, and can’t easily be made into a structural member of the car itself.
As a “battery” (with fuel cells) , it also doesn’t have great power density. Power comes for free when adding batteries. Every battery added improves power capacity. Not so with hydrogen. You need to add both hydrogen and more fuel cells to get more power. That’s why BEVs is also doing well for racing cars and hyper cars (see pikes peak race for instance)
In places where volume and power isn’t important, hydrogen could be promising. Trucks and ships are obvious candidates.