Translation:The duck does not eat the soap when it swims in the water.
Because it is the normal pronun. the subject pronun for the third person (translation of "it") is den. there is a possible confusion because in english it is neutral while in danish both and and sæbe are common (-en words) and then use the pronun for common names, not for neutral. But being grammatically common doesn't make them persons in real life :
If it was drengen and not anden then the subject pronun would be han and for a pige it would be hun : Han/Hun svømmer i vandet.
Another minor confusion is because the sentence is not clear about who swims in the water, the duck or the soap, but in this situation it doesn't change the pronun.
If it was referring to both of them swimming (The duck doesn't eat the soap while they swim in the water) then the subject pronun would always be the plural "de" (They) : "Anden spiser ikke sæben, mens de svømmer i vandet" or " "Drengen spiser ikke pigen, mens de svømmer i vandet". Here the confusion, again, would be about who is swimming, the boy and the girl or their parents ? But this is going too far.
Finally, the sentence would be easier if it was a boy instead of a duck because then we would know who is swimming. "Drengen spiser ikke sæben, når HAN svømmer i vandet" -> Boys does not eat the soap when HE ( the boy) is swimming or "Drengen spiser ikke sæben, når DEN svømmer i vandet" -> Boy does not eat the soap when IT (the soap) is swimming.
I hope it helps clarify this bizarre sentence
In English, soap would 'float', not 'swim'. It appears that in Danish 'svømmer' can also mean 'float'. In German (my native language) 'schwimmen' can mean 'swim', but also 'float' (in particular if it the object in question is being carried by the current). Thus, when I was learning English as a boy of 11, I said 'the toy ship swims in the creek' much to the amusement of my American peers.