I think the simple answer to your question is that Walter Mitty's daydreams transport him as far away as possible from his terrible wife and monotonous, pathetic existence, and make him become the precise opposite of the hen-pecked, dominated and easily cowed man that we see in his real life.
Again and again, in the narrative of Mitty's real life which is interspersed by his daydreams we see a clear picture of how weak-willed he is as a character, and how his wife completely rules him. Consider the following example:
"Remember to get those overshoes while I'm having my hair done," she said. "I don't need overshoes," said Mitty. She put her mirror back into her bag. "We've been through all that," she said, getting out of the car. "You're not a young man any longer." He raced the engine a little. "Why don't you wear your gloves? Have you lost your gloves?"
Note the way that Mitty silently gives in to his wife and her demands. She treats him like a little dependent child, and his only act of rebellion is to "race the engine a little" which shows his impatience to get away from her, but this is only done furtively. Thus we can understand the way in which in his daydreams he becomes the dominat, charismatic, strong, brave and courageous hero that is so obviously far from the truth in his real life.