There’s quite a few reasons relating to different time periods, but interestingly there are actually several examples of square-shaped coins.
The most obvious reason is ease of use, so to say. It is easy to pick up round coins and scoop them up, put them into tightly packed bags, etc, without any worry of corners causing issues.
Then there’s the fact that coins are intended to be hard wearing and semi-permanent, since there are coins likely older than you or me still in circulation. A round shape is less likely to wear down unevenly since no one part of it sticks out further than the rest from any angle.
A little historically, a lot of coins were made by pressing down a small ingot with a pre-made stamp. This typically forces the metal into a rounded shape anyway and means less work to finish the coin – and coins had to exist in relatively large quantities.
In a modern day setting, arguably cutting coins into squares from a metal sheet would be more efficient, but it’s not too much extra work to take the leftover metal and melt it down to use in the next batch. A key modern reason for rounded coins is that round coins are convenient for transport within vending machines, etc, since they will roll easily.