A cylinder (or even better, a sphere, but a spherical battery isn't a very convenient shape to use inside a device) is a much more efficient use of material for resisting internal pressure than a box with flat sides, in case the battery fails or overheats.
With a box shape, the sides can bulge outwards and then break off where they join at the edges. A cylinder doesn't have any "edges" except where the end pieces join the cylindrical wall.
Aside from the stress analysis considerations, the shape with the biggest ratio of enclosed area to circumference is also a circle - so even for an unpressurized container, a cylinder uses the least material to hold a given volume. For the same volums, a square section container has about 27% more surface area than a cylindrical one - and that means 27% less "dead weight" and material cost.