Jan Tregeagle is a character from Cornish folklore. He's basically a naughty man who did some bad things, and as a punishment the spirits made him do a bunch of tasks that seem almost impossible to complete. The tasks were things like emptying a pond with a leaky shell, or counting all the grains of sand on the beach.
People tell stories about Jan Tregeagle to scare children into behaving, because they don't want to end up like him. But some of the stories also say that he was able to outsmart the spirits and complete all the tasks, which made them release him from his punishment.