Somebody else has already done the heavy lifting on this one, so rather than merely parroting their article I will instead link to it. Here I will provide only a cursory exploration of the yearly celebration. Krampusnacht, or Krampus Night, occurs on December 5th each year. Why December 5th? Because December 6th is the date assigned for the celebration of the life of Saint Nicholas, aka Santa Claus, who died (according to legend) on December 6th, 343 AD, after being imprisoned by the Roman Emperor Diocletion (again, according to legend), the night before this feast day was assigned to Krampus. Celebrations of Krampusnacht have been occurring for at least a thousand years!
Krampus is almost certainly a carryover from pagan times, assimilated into the Christian celebration of Christmas, much like the Christmas tree (folks were decorating trees and bringing them indoors during winter before there was a Christmas to celebrate) and the decking of halls with holly. As good was seen as having conquered evil, Krampus, branded a “devil” by the early Christian proselytizers in that part of the world, became subservient to Saint Nicholas. He still got to engage in his favorite behaviors—preying on children—but under Santa’s watch he could only beat and punish children who had misbehaved. In this respect he serves the same function as the ubiquitous “boogeyman”. He is there to scare children into being good—or else.