Swimming during your period is not a problem from a purely physiological point of view. That said, we know that the thought of swimming with a period can be uncomfortable. We've all had the fear of something leaking and someone noticing - whether in the public swimming pool, in the sea or at the lake.
If something leaks and someone notices it: Period blood is neither unhygienic nor bad in any way, but something completely normal. Unfortunately, this hasn't reached everyone out there yet, but please don't let that unsettle you too much. Especially since there is chlorine in the water in public swimming pools and also in most pools for disinfection.
On your heavy period days, period products can help you prevent leakage. Here, too, we would like to clear up a myth: Yes, if you use tampons while swimming, they can soak up water. This is perfectly normal and not harmful to you. However, it is important that you remember to change your tampons more often when you swim.
On the one hand, once tampons have become soaked with liquid, they are less able to absorb further liquids. On the other hand, the water quality, e.g. in lakes, can sometimes vary greatly. A tampon that has soaked up water that is not clean should not stay in your body for too long.
Using pads in the water is less recommended. They also absorb a lot of water and can hardly absorb any other liquids. The real problem here, however, is usually the adhesive which is attaching the pads to the bathing suit or bikini. It can easily happen that it loses its adhesive strength in the water and you lose your pad while swimming.
Menstrual cups do not soak up water during swimming. It is very unlikely that water will run into the cup from outside. If you use them correctly, they are hygienic and they have the advantage that you don't have to worry about tampon strings sticking out.
If you know you want to go swimming during your period, it's best to take some extra period products with you to be on the safe side. If you're swimming in a place that doesn't have restrooms or changing rooms, it's best to pack a bag or similar for disposal of disposable items. Most disposable period products are non-recyclable and are made from material that is not naturally degradable.