the short answer is that these units are used because they are easy for people to understand based on their everyday experience but they are missing important information to make them properly meaningful in the context of physics.
The fundamental reason is that measuring fuel economy in miles per gallon (or litres per kilometre) in the first place isn't very physically rigorous and relies on the assumption that the 'gallons' we are talking about are gallons of fuel. Even then what we are really interested in is the energy that the fuel contains.
Here the link between volume and energy is implied by everyday experience because we buy fuel by volume and the volume of fuel is what we notice decreasing as we drive but in terms of actual units the energy density of that fuel is left out for convenience, most people don't think of a litre of fuel as being x number of kJ of energy.
To get properly meaningful physical units you need to know the density of the fuel and its energy density in chemical energy per unit mass (ie the difference in enthalpy between the fuel and the combustion products when burned in air).
Fuel is sold by volume because that's the easiest thing to measure consistently, even though what you actually want is energy however it would be very difficult to consistently quote the actual energy of a litre of fuel sold on a given day at a given location.
A properly detailed model of how much energy a car uses to travel a certain distance is quite complex and will, at the very least depend on the thermal efficiency of the engine, the acceleration profile, changes in elevation and various friction and drag coefficients.
Note that travelling a given distance doesn't require any energy at all. The energy gets used up in accelerating (or more precisely decelerating) the mass of the car, climbing hills (ie doing work against gravity) and various frictional losses (notably aerodynamic drag) as well as the various ancillary systems of a car.
So from a first approximation if you wanted to estimate how much energy it takes to get a car from point A to point B you would say none as it has the same kinetic energy when it arrives as when it leaves, it's only when you take into account the energy losses on the way that you get a useful figure.
This is a different situation from say carrying a bucket of water up a hill as in this case you know that there is a certain gain in gravitational energy that you must put into the system as a bare minimum.