Other people have already said "manufacturing" so I will not repeat that.
What is worth emphasizing though is that soda cans are pressurized to 2 atmospheres of pressure or more.
Side-note: this is why the container is made of metal in the first place. Few other packaging materials can deal with this load while maintaining any kind of integrity or stability, the other competitors chiefly being glass or PET.
The cylinder deals with this easily since the load becomes equal in all directions, and it is simple to strengthen it at the top and bottom. The cylinder maintains its shape under pressure.
A square shape on the other hand will start deforming. Pressure on a flat surface will cause it to bulge. Just as it is impossible to pull a hanging wire until it is straight without sagging, you cannot subject a flat surface to pressure without bulging.
For non-pressurized products, other package shapes are common, the square one as well. But for pressurized products, you will find that cylinder packaging is next to universal.