Don't want to put anyone off from going swimming but I once went with a friend who was presumably using a tampon and, when she got out of the pool, rivers of blood poured down her legs. I was too embarrassed to tell her (not a bosom pal) and I think she only noticed when she was standing in the communal shower and blood was pouring down the plug hole. I know another woman noticed then. I felt mortified for her but I just didn't have the sort of relationship whereby I could tell her.
If I have a bath with a tampon in, I find the water must soak up the tampon and fill in and so when I get out, I leak everywhere, and I presume that is what happened to my friend.
So I wouldnd't necessarily advise that you can swim with a tampon in.