Word for unconscious body movements
Solution 1:
You are referring to mannerisms.
"You could tell Fred was deep in thought because he was tapping his temple with his finger. He always displays this mannerism when lost in thought."
M-W:
mannerism noun
2 : a characteristic and often unconscious mode or peculiarity of action, bearing, or treatment
The actor can mimic the President's mannerisms perfectly.
'quirky mannerisms such as toying with her hair and tapping her toes'
Solution 2:
That is called a tic, or sometimes expanded to nervous tic. As described in the wikipedia link, a tic is a sudden, repetitive movement or sound that some people make, which can be difficult to control.
Note the spelling with no k, a tick with a k is an arachnid.
Solution 3:
I would call this fidgeting.
Fidg·et / ˈfijit/
• v. (fidg·et·ed, fidg·et·ing ) [intr.] make small movements, esp. of the hands and feet, through nervousness or impatience: the audience had begun to fidget on their chairs.• n. a quick, small movement, typically a repeated one, caused by nervousness or impatience: he disturbed other people with convulsive fidgets.
- a person given to such movements, esp. one whom other people find irritating.
- (usu. fidgets) a state of mental or physical restlessness or uneasiness: a marketing person full of nervous energy and fidgets.
DERIVATIVES: fidg·et·er n. fidg·et·y adj.
—"fidget." The Oxford Pocket Dictionary of Current English, via Encyclopedia.com. 12 Dec. 2016.
In your sentence,
You could tell Fred was deep in thought because he was tapping his temple with his finger. He always displays this fidgeting when lost in thought.
Or
You could tell Fred was deep in thought because he was tapping his temple with his finger. He always displays this (particular) fidget when lost in thought.
Examples of fidgeting used for this:
A new study finds that fidgeting — the toe-tapping, foot-wagging and other body movements that annoy your co-workers — is in fact good for your health. —Gretchen Reynolds, "Why Fidgeting is Good Medicine", New York Times, 9/14/2016.
Fidgeting is making small movements with your body, usually your hands and feet. It’s associated with not paying attention. Fidgeting often reflects discomfort and restlessness. For example, if you’ve been listening to a lecture for a long time, you may find yourself tapping your pencil. —"What causes fidgeting?" Healthline.com.
And examples of usage of fidget on its own as a noun for this kind of action (definitely the less common of the two terms):
Nicks started fiddling with the tassels streaming from her mike stand, an annoying fidget that continued intermittently throughout the show. —Bill White, "Nicks still casts a musical spell", Seattle Post-Intelligencer, 8/14/2001.
Tap tap tap tap. Tim Caton taps his pencil on his desk in his hospitality management class. To classmates, it’s an annoying fidget. But Caton heeds a different beat. —"Life by the Numbers", Vox Magazine, 10/11/2012.
Man, I'm slow! Just noticed that this was suggested in comments while I've been typing. Hat-tip to @stevesliva.
Solution 4:
"Tic" is a great suggestion because it precisely fits the definition. In the interests of variety, let me suggest another word which is a close fit: twitch.
VERB
Give or cause to give a short, sudden jerking or convulsive movement:
- [no object] ‘her lips twitched and her eyelids fluttered’
- [with object] ‘the dog twitched his ears’
Oxford English Dictionary
Another Dictionary actually includes involuntary movement in the definition.
to make a sudden small movement with a part of the body, usually without intending to.
- He tried to suppress a smile but felt the corner of his mouth twitch.
Cambridge Dictionary