For six hundred years, at least, a hogshead was a measure of liquid capacity has been in our language (and taken into other Teutonic languages, with hog sometimes changed to bull or ox), but as yet the mystery of its source or a plausible reason for the name remains unsolved.
One guess, quoted by the learned W. W. Skeat, is that the earliest cooper of these casks of two-barrel size branded his product with the outlines of the head of a hog or of an ox.
But Skeat also says that most of the conjectural sources are “silly.” And we have nothing to add to that.