The best shape for containing a pressurised gas is a sphere, where by `best' we mean the shape that uses the smallest amount of material to contain a given mass of gas at given pressure.
The simplest explanation for this is that, since pressure acts equally in all directions, the best container of pressure is a container that looks the same in all directions -- which is a sphere.
We can see this by examining a pressure vessel made of a liquid: the walls of such a pressure vessel will flow to take up the best shape. Pressure vessels made of liquid are known as 'bubbles', and it is well-known that bubbles tend to be spherical.
The bathyscape Trieste, built in Italy in the Fifties, carried its crew in a steel sphere down to a depth of 11 km below the surface of the ocean. This is a good illustration of the suitability of spheres for withstanding pressure.
So why are scuba tanks cylinders rather than spheres? The cylinder is a compromise between the best pressure-containing shape and the need to mount the tank comfortably and conveniently on the diver's back. Similarly, gas cylinders in laboratories are usually cylindrical, since this allows them to be moved and stored conveniently.