"Dangerous goods" is an extremely broad category that covers both environmental concerns and handling/storage concerns. A shipment full of batteries or deodorant/paint spray cans is not really dangerous if it gets thrown into the sea, but firefighters need to know that in case a fire breaks out.
And you don't want to place something like pyrotechnics next to tires next to ammonium fertilizer as it was in that warehouse in Beirut.
tl;dr: "dangerous goods" classification is most important for on-shore handling and safety considerations, not because of environment concerns in case of an at-sea loss.