To understand where the compulsion to doodle comes from, the first thing you need to do is look more closely at what happens to the brain when it becomes bored. According to Jackie Andrade, a professor of psychology at the University of Plymouth, though many people assume that the brain is inactive when they’re bored, the reverse is actually true.
This brings us back to doodling. The function of doodling, according to Andrade, who recently published a study on doodling in Applied Cognitive Psychology, is to provide just enough cognitive stimulation during an otherwise boring task to prevent the mind from taking the more radical step of totally opting out of the situation and running off into a fantasy world.
Read Bored? Try Doodling To Keep The Brain On Task from NPR.