The dunce cap is a tall, conical hat that, according to custom, was a method of discipline for stupidity or poor study skills in the education system. According to custom, a student who didn't finish their lesson, or who otherwise didn't comprehend the subject being taught, was forced to wear this large conical hat that, incidentally, made them the object of ridicule. How was such an arbitrarily bizarre punishment ever conceived?
Go back to the late middle ages, in Scotland.
John Duns Scotus (you can see it starting already) was a popular philosopher of the time. His philophies were largely respected until the late 1600's, when Reformers and Humanists started to attack his work.
Over the past 400 years or so, his name (Duns, remember?) had already become associated with pedantry. So, when Duns's supporters fought against the "new learning" with such earnestness, it only made his name more synonymous with Idiot.
So what of the hat? Among the mystical things that Duns believed was that a pointed cap would help learning, by "funneling" in the knowledge. He though that a funnel to the peak of the head would work best, like the hats of wizards (cornuthaums) like Merlin.
Clearly, in the last century, nobody still believed that the pointy hat magically made slow children learn more quickly, but the theory was adapted to make the mortifying experience of the hat and title of "Dunce" motivate the child to learn faster. This is, of course, closer to what happens in practice, with the exception of the learning part.
Thankfully, the days of children being forced to wear a dunce cap and being derided for undiagnosed dyslexia are far, far behind us. Can you imagine the shit-storm that would fall on the teacher who used one in the present day?
Of note: In Nethack, a dunce cap caps your intelligence at 6. This makes it an effective way to keep from being killed by brain-sucking which occurs when your intelligence drops to 3. A Wizard's Cornuthaum, on the other hand, is identical in appearance, and grants clairvoyance and increased spellcasting ability, if a wizard.
He was dressed in a flowing gown with fur tippets which had the signs of the zodiac embroidered over it, with various cabalistic signs, such as triangles with eyes in them, queer crosses, leaves of trees, bones of birds and animals, and a planetarium whose stars shone like bits of looking-glass with the sun on them. He had a pointed hat like a dunce's cap, or like the headgear worn by ladies of that time, except that the ladies were accustomed to have a bit of veil floating from the top of it.
The Once and Future King, by T.H. White
A wizard! Dooley exclaimed, astounded.
The Elfin Ship, by James P. Blaylock
At your service, sirs, said the wizard. How perceptive of you to notice. I suppose my hat rather gives me away. Something of a beacon, I don't doubt. His hat was pretty much that, tall and cone-shaped with stars and crescent moons all over it. All in all, it couldn't have been more wizardish.