dnd 5e – What are the circumstances of Traxigor’s transformation and do they explain how he retained his magical abilities as an otter?

It’s a Wish, used free-form. It’s not limited to just what Polymorph spells can do.

As far as his current state, that pretty much resolves all discrepancies right there. He was transformed via Polymorph into an otter (for a maximum of 1 hour), during which time he was unable to cast, he decided he liked it, and he risked a Wish in an attempt to give it to himself permanently while also retaining his spellcasting. Luckily for him, the Wish worked out reasonably well.

Worth noting that regardless of how it happened it would have to have been a free-form Wish rather than a spell-duplication Wish, as spell-duplication Wish is not able to duplicate 9th-level spells, and there are no permanent polymorph effects before then.

But we don’t know precise details of how it happened, because there’s very little actual information here.

As far as previous lore is concerned, it appears that there isn’t any. At least according to the Forgotten Realms wiki, this particular Otter Archmage was created for the adventure itself.

Now, the chain of events that would make the most sense would be that he was polymorphed, he liked it, he possibly polymorphed himself a few more times, he didn’t stop liking it, and so he carefully crafted a Wish for himself so that he could enjoy it permanently without losing his spellcasting, which (as a wizard caster capable of casting 9th-level spells) he cast himself.

On the other hand, we don’t know that to be true with certainty. The wording in particular is a bit odd here. “His otter form was made permanent” seems to imply that the Wish was used while he was under the effects of Polymorph, perhaps for the first time, thus requiring both another caster and a more complicated Wish.

Even so, it’s both beyond the scope of the information we’re given and also not terribly important. The text could be read in a number of ways. Regardless of how you read the text, you could do that thing with Wish. No other information has been provided, or is likely to be provided. He’s a bit character in a specific adventure, whose most significant feature is that he can be used as an excuse by rules lawyer powergamers who want to abuse Polymorph to make their 12th-level characters able to cast 9th-level wizard spells. I suspect that the wording is awkward just because the person who wrote it couldn’t be bothered to put that much attention into the few sentences of description that the archmage was allotted.

If the specific details of the episode matter for your compaign, then it’s going to have to be DM adjuducation, and that’s all there is to it.