It doesn’t, but on average it does.
The problem is "bad relationship" is a broad and fuzzy concept, often conveniently left undefined or defined selectively to bolster a particular position.
There are definitely situations where divorce is probably good for the kids (e.g. the more extreme ones, like physical abuse). However there are other perhaps more common situations where divorce is on the whole harmful to the kids (e.g. mom and dad just don't have "that spark" for each other anymore).