It can be, but you have to get the hydrogen from somewhere, typically through chemical separation processes such as electrolysis. So Hydrogen is not available to be mined or drilled, it must be made (separated) using energy. Where that energy comes from is another problem.
Additionally, hydrogen has a much lower specific energy density than hydrocarbon fuels, and it's difficult to store in large amounts compared to gasoline or diesel because it requires high pressures and/or low temperatures to get the density up. Metals used in engines today also have problems with hydrogen embrittlement which reduce their strength and wear properties.
These are just a few of the problems.