If water gets in your ear canal -- while you're swimming or taking a shower, for instance -- earwax will cause the water to bead up and move away from your eardrum. Then the slipperiness of the wax encourages the water to run out of the canal. In addition, earwax is slightly acidic, which discourages bacterial or fungal growth in the moist, dark ear canal. Without earwax, it would be much harder to avoid ear infections.
In a way, it's part of a self-cleaning system. Most people don't need to do any ear maintenance at all. Earwax slowly migrates toward the opening of the ear canal and is sloughed off. If you want, you can take a washcloth and, using your finger, gently wash the opening of your ear.
Whatever you do, don't poke a cotton swab into your ear. A swab may remove a little wax, but it's also likely to push some deeper into the ear canal. Because the canal is hourglass-shaped, earwax can create a plug that won't come out on its own. Most of my patients with impacted earwax created the problem themselves with cotton swabs.
this is off of webmd.com, written by a professor of otolaryngology at uc san francisco