Walter Mitty first imagines himself flying a Navy airplane through a terrible storm; his men are scared and his bravery gives them hope and courage.
Mitty then imagines that he is a surgeon of great skill, overseeing an operation; when an anesthetic machine breaks, he is able to fix it, and the other doctors ask him to step in when the surgery becomes difficult.
After that, Mitty imagines himself on trial for murder. Although he has an alibi, he is the world's greatest pistol shot and could have committed the murder with either hand; this admission results in a courtroom commotion:
...suddenly a lovely, dark-haired girl was in Walter Mitty's arms. The District Attorney struck at her savagely. Without rising from his chair, Mitty let the man have it on the point of the chin. "You miserable cur!" . . .
(Thurber, "The Secret Life of Walter Mitty," bnrg.cs.berkeley.edu)
Next, Mitty dreams of being an ace fighter pilot, the only one left after all the other pilots are taken sick with fear. Mitty prepares to fly alone into a hail of anti-aircraft fire, the only hope of the Allies.
Finally, Mitty tries to relax with a cigarette, and his subconscious places him on the wall of a firing squad. To his mind, he will never escape his tepid, ordinary life, and so he is doomed.
In each fantasy, Mitty is the hero and the center of attention; in reality, he is entirely normal, and other people barely notice him.
He dreams of being in the army.