tl/dw:
A barrel (bbl, short for blue barrel) is 42 US gallons, because the Standard Oil Company used blue-colored barrels of that size in the 19th century. The standard was actually 40 gallons, but they added 2 to accound for spillage and leakage.
The US gallon comes from a cylindrical wine gallon with depth 6 inches and diameter 7 inches.
It's defined as being 231 cubic centimeters. Which only works out if you use 22/7 as the value for π.
And it gets worse from there...