We don’t recommend it.
Swim caps are really ideal for this. And plenty of women with their own bio hair wear swim caps and no one ever bats an eye. ;)
However, if you really want to swim in a wig, we recommend buying one specifically for this purpose. Chlorine can really do a number on your wigs, so it's best not to wear them in the pool unless you have a spare to wear outside of it.