This question can be answered with one word: money. When a boat is at sea, it obviously does not have access to plumbing (both fresh water and sewage waste). Therefore, all fresh water needed for passengers and crew to drink, wash, bathe, use the toilets, etc. must be stored in enormous storage tanks housed behind the hull. Similarly, all of the wastewater sewage from bathrooms and kitchens must be stored in waste storage tanks. When the ship docks at a major port, this is the time when they refill the freshwater tanks and discharge the waste tanks into the local municipal sewage treatment system. All of this, of course, costs money. The cruise lines have to pay the local municipalities for the use of their sewage system. If they can simply dump the waste quietly into the ocean without being detected (because it is highly illegal), this saves them money which increases the bottom line (profits). It's the same situation with solid waste from kitchen trash and garbage cans. It must be stored in enormous sealed containers until it can be disposed of at port. If the trash is dumped into the ocean, it is again a cost savings to the cruise line.