The air vent, usually referred to as the air gap, is designed to prevent water from leaving the dishwasher before it is supposed to. When the dishwasher pumps water out of the drain hose, the suction created can cause the water to be siphoned out before it should be. The air vent provides a place for the water to go so that this does not happen.
Water comes into the air gap and flows out into the sink if the line between the drain line and the sink trap or garbage disposal is blocked. When this happens, the water can't make its way to where it is supposed to go and it comes up out of the air vent instead. This keeps a backup of the dirty dishwater from occurring.
One of primary ways that the air gap can be cleaned is by simply disconnecting the line and cleaning it out by either flushing it out, blowing into the line until the obstruction comes free or using some type of mechanical device like a plumbing snake to remove the debris.
A couple of other issues might cause water to come out of the air gap instead of properly draining. One is the fact that the sink drain itself might be draining too slowly, causing the water to back up into the drain hose and thus back up through the air gap. It is also possible to forget to remove the cap to the connector to the garbage disposal known as the knockout plug. If this is not removed, the water can't get from the dishwasher to the disposal to continue the drainage process. This too can cause the water to back up through the air vent.