Sounds to me like he's employing an acceptable coping mechanism for boredom, while also learning a valuable lesson about following directions. Where's the problem?

I would tell the teacher that if she wants him to pay attention, she ought to offer him something to learn.