Swimmer's ear, also known as otitis externa, happens when the outer ear canal becomes infected by bacteria or fungi. The infection is commonly caused by water exposure, which leaves the ear canal moist and vulnerable to infection. Bacteria and fungi thrive in this damp environment. Other factors, such as inserting objects like cotton swabs or earplugs, can irritate the skin in the ear canal, making it easier for bacteria to invade and cause infection.
Sources: