We’ll start out by saying that, obviously, not every milk jug has the same shape. You can find square gallons of milk just about everywhere, and in a lot of places, milk doesn’t come in a jug at all! In Canada, for instance, it’s not uncommon to buy milk in plastic bags which you then cut the corner off of and store in a designated pitcher in the fridge. But when you picture the quintessential gallon of milk, it has circular dimples on its sides.
The circles built into milk jugs provide several benefits, but the specific reason those circular dimples exist actually isn’t specific to milk at all. The circular indentations allow the milk jug to flex slightly, rather than keeping a solid, rigid shape. This is super important if you ever happen to accidentally drop a gallon of milk. Rather than cracking or shattering, the semi-flexible plastic used to make the jug, along with the indented design, allows the jug to take a harder hit.
This is because the indents provide a place for the jug to expand outward when the pressure spikes (kind of like how water balloons sometimes just sort of squash outward and then bounce up unharmed when you drop them on the ground). Obviously, it’s still possible to drop gallons of milk hard enough to break them open, but the circular indents prevent this from happening more often than not.