The Swim skill determines how fast your breath bar goes down when you are underwater. Once your breath bar is empty, you'll start drowning. While drowning you'll constantly lose hit points until you reach the surface or you die.
Swimming is penalized by twice any Armor Check Penalty value. Therefore, it can be a good idea to remove heavy armor and shield before you dive - unless combat awaits when you surface again.
Each point in Swim increases your swimming speed by roughly 1%. The Swim skill was once thought to also affect how fast you fall through air, but this has. It does not affect your falling rate or your movement speed when falling; however, it does affect your movement when under the effect of the "fly" spell.
Special: The Armor Check Penalty is doubled for the Swim skill.
Note: Some areas in quests can only be accessed by underwater passages - some optional, some mandatory, of varying lengths and challenges. If you have no or few ranks in this skill, it's a good idea to have some magic items around to either remove the need to breath or increase your Swim speed when necessary.