The best place to have a port is in a location where the water is deep enough and the ships will be protected from bad weather and big waves. Ports also need easy access to roads and railways to transport cargo to and from the ships. Many coastal cities have grown around good locations for ports.
In the past, ports were built at the mouths of rivers. This gave ships shelter and access to fresh water. The rivers were also used to transport freight by barge to and from inland towns.
The location of most of Australia's coastal cities were chosen because there was a good natural place to build a shipping port.
Today bigger ships are being built and these carry more cargo. Bigger ships can't be handled by some ports because either the water may not be deep enough or the ship is too long to turn around. Some ports need to dredge deeper channels to handle these larger ships.