Many new parents don't realize what natural swimmers their babies are. Until around 6 months, babies placed in water tummy-side down will move their arms and legs in a swimming motion. When the swimming reflex and the dive reflex are both engaged, a baby can then turn on their innate swimming ability. Researchers studying the dive reflex in babies found that none of them inhaled water or choked when they were under water.
The babies didn't seem worried about the next dive at all. In fact, some seemed eager to dive again! These reflexes don't mean the baby can swim unmonitored as they can still drown, so supervision is always required. We also don't recommend taking your baby to a chlorinated pool for swimming classes especially indoor. If you can find a pool whether private or recreational using salt, it's a lot less toxic and better for both you and baby.
When a baby is able to walk, they can even be taught how to survive until help arrives if they fall into the water without the ability to swim.