Everybody probably has a vision of a medieval gargoyle in their head, based on the one on top of a tower of Notre-Dame, with a "I hate Paris" expression on his face.
This gargoyle is however not medieval. He was created in the middle of the nineteenth century as part of the restoration of the cathedral done by Viollet-le-Duc, who had no trouble adding things that looked like what he would have put there if only he'd lived in the twelfth century.
But grotesques were part of real medieval architectural decoration. (A gargoyle is, strictly speaking, a stone carving of a grotesque form serving as a waterspout, but people tend to use the term more broadly. Le Stryge, the official name of Viollet-le-Duc's gargoyle, was never intended as a water spout.)
Grotesques were intended as part of the church decoration that portrayed the whole existential universe, saints and sinners, demons and angels, the saved and the damned. Demonic figures warned viewers about what would happen if they did not give up their sinful ways. In addition, some grotesques were meant to represent peoples from other parts of the world, such as the upside-down people supposed to live at the South Pole, or the people with heads of dogs who everyone knew lived off in central Asia or somewhere.
Bernard of Clairvaux, revered abbot of the Cistercian monastic order in the first half of the twelfth century, wrote dismissively of grotesques, saying that they distracted from the contemplation of higher issues. He said that even if they did not embarrass, one should at least think of the high cost. Cistercian churches never had grotesques, but everyone else continued to do so.
In addition, on some churches the stone carvers created galleries of what certainly look like real people. One assumes these were the faces of the other workers on the church, preserved for posterity.