Gargoyles are part of the marketing campaign by the Christian religion. When the churches with gargoyles on them were built, a lot of people believed in ghosts, evil spirits and the like. Furthermore, most people couldn't read or write. How could the church reach all these people and make them believers?
The church decided to use symbols and symbolism. Churches were frequently the first buildings in an area built of stone and brick rather than wood or dirt, making them good places to hide and fortify yourself from attackers. Churches were considered sanctuaries even by robbers and killers, inside a church you were safe from the many of the problems of the outside world. And spiritually, evil spirits and all the bad things that might be out to get you would never enter a church, because it is God's house and God is keeping them out - they are too scared to enter.
Gargoyles are the churches' advertizing signs, telling people who can't read that this is the kind of bad spirits and monsters you may run into when you're outside the church, whereas you're safe and with less worries when you're inside the church, both literally and figuratively. When you're a believer, you're protected from bad things that might otherwize be out to get you, but as a believer you're inside, away from the reach of the evil things on the outside. On the Nidaros Dome in Trondheim, Norway, the theme is expanded to how it may look when bad spirits have gotten to you.
The builders of the churches did not stick to the scary theme all the time, but got creative with the concept of different or even funny ways to have water spout from a figure. On the Stephansdom in Vienna thjere is a cow spouting water from its mouth and a man with a pot on his shoulder from which the water comes.