A barrel of oil is 42 US gallons. There really aren’t any physical barrels of oil anymore – oil is transported in bulk, by tanker ship or pipeline. But the barrel measurement continues in much of the world.
Back in the early days of oil exploration, they literally moved oil around in barrels. They had to standardize the barrel size, which they did, and it just stuck. They picked the number based on a 1400s-era law that standardized the barrel size for the packing of fish.
This is not the only measurement. In Europe, they measure oil in tons; in Japan, kiloliters.
Lots of commodities are still measured in barrel units, it turns out. Before standard measurement, a barrel was the standard measurement for all sorts of things. Those were eventually converted to conventional units, but the commodities are still traded in aggregate units equal to their original transportation medium.
(Also: the standard size of the container most Americans associate with the word “barrel” is 55 gallons.)