Yes, swimming can cause a cough in kids, often due to water entering their airways.
According to Dr. Boniface, when children cough or spit out water while in a pool, it's likely because they've swallowed a significant amount of water, with some of it reaching their lungs. The body then tries to expel this fluid. This is a natural reaction to the presence of fluid in the respiratory system.