A new study suggests that intensive intellectual activity prompts snacking, even though the calories consumed by 'thinking' compared to a rest state are infinitesimal.
Thinking does demand brain energy, in the form of glucose - since brain cells consume 2x the energy of any other cells in the body. However, since the cells can't manufacture glucose it must be consumed and passed to the brain via the bloodstream.
To avoid undesirable weight gain connected with this additional eating, mental activity should be counterbalanced by physical activity, which consumes more calories overall and may have an appetite suppressant effect (known to runners and other repetitive cardio trainers). It may be that our body seeks this mental and physical balance.