Of course, Walter's imaginings are the basis of his character. The content of his fantasies let us know everything we need to know about his aspirations, his failings, and his dissatisfaction with his own world. For example, Mitty dreams of being in charge (a surgeon, a pilot, a Commander). This tells us that, in real life, he's bothered by his lack of control – his wife calls all the shots. The fact that he retreats into fantasy at all, never mind what he fantasizes about, also tells us something about Mitty, although the conclusion we draw from this is subject to debate. It may be that he is ultimately a strong character, who doesn't let himself get down despite being derided by those around him. Or it could be that he's ultimately defeated and is forced to retreat into fantasy because he can't face reality. What do you think?
Walter's relationship with his wife tells us a lot about his dissatisfaction with his real life. His wife is domineering and bossy, and doesn't let Mitty make decisions on his own. She treats him as though he's incompetent. This is how many of those around Walter treat him – think about the cop or the parking attendant or the mechanic whom Walter remembers. He dislikes being a submissive and passive man, and so he compensates with his fantasies.
Speaking of Walter's marriage, how do we know that Mrs. Mitty is domineering and controlling? Entirely from the way she speaks to her husband. Mrs. Mitty bosses Walter around without listening to him at all. Even when he expresses himself at the end – when he argues that he was simply thinking – Mrs. Mitty ignores him and insists they ought to take his temperature at home.