Mitty's flight into fantasy is generated by a life of banality. The life constructed for Walter in which his wife is pestering him and nagging him is one reason why Walter retreats into his fantasy world. In his fantasies, Walter is central to consciousness, a man of doing and one who represents importance. In his reality, Walter is an accessory, something that is peripheral. The importance Walter has in his dreams is absent in his reality. Another reason for his flight into fantasy might have something to do with gender roles. In his reality, Walter is depicted to be a man who lacks the authority and the stature to be considered as a representation of "masculinity." He is slight of frame, not overwhelming in terms of physical presence, and inept in terms of handiness, as is seen with the car and the chains on tires that he puts on axles. In his dreams, though, he is a marksman, militaristic, and a ladies' man in his aim, and someone who typifies the heroic conception of masculinity. The inversion of gender roles in fantasy when juxtaposed with reality helps to fuel his desire to escape.
To answer this question it is important to examine Walter Mitty's "real" life, that ironically seems to be less real than his day dreams. One reason becomes swiftly clear: he is married to an overbearing, dominating woman, who appears to be particularly irritating. Note how Mitty is shaken from his first daydream that starts off the story:
"Not so fast! You're driving too fast!" said Mrs. Mitty, "What are you driving so fast for?"
She has the habit of repeating phrases whilst she is complaining and that adds to her irritation. Note how Mitty turns to her and finds her "grossly unfamiliar." It is clear that the "silence" in which Mitty responds to his wife's complaints is the normal state of affairs, and as we go through the story, we see just how dominated he is by his nagging wife as she bosses him around.
However, it is also clear that in his real life he is a weak and innefectual character. Note how he says that he is unable to take the snow chains off of his car, and the people that come to help him make fun of him. He fantasises about putting his arm in a sling so that they will not do this again. He is also unable to remember what his wife tells him to buy, and as he reflects, "he was always getting something wrong." It is only when Mitty, in his dream, punches the District Attorney and calls him a "miserable cur" that he remembers he had to buy puppy biscuits. It is the intense banality of his life combined with his profoundly weak character that gives him such a desire to find release in his daydreams.