For humans, swallowing saliva is an involuntary action (meaning our brains automatically do it without thinking about it). For dogs, swallowing saliva is a voluntary action (meaning they do it intentionally and their brains have to think about it in order to do it).
When dogs drool it is because they "forget" to swallow. Dogs usually drool when their brains are focused on something else - maybe food, maybe another animal. Because they are not thinking about it, the brain doesn't give the signal to swallow and the excess saliva drips out of their mouths... hence, drool :)
Some dogs are also more prone to drool because of the way their jowls are - the droopier the jowls, the more drool you'll see.
Dogs drool because it is a natural behavior to them. For many breeds drooling is quite normal and it is something you may want to take into thought before getting a dog. More often than not, it is not all that serious.