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.
It takes him to a place where his admired by every one because he always saves the day
His "secret life" takes him to a world of amazing and fantastic adventures beyond the world of imagination where he goes into many places and takes on many scenes, like an real court room trial drama the dark age of war where he fantasies himself as a brave bomber pilot about to go on a dangerous mission of great risk and a real life brain surgeon where he undergoes brain surgery on a prominent banker. All his "daydreams" which he indirectly taken part him turn him to a hero, where he tastes a lot of success, which gave him tons of courage and makes him a real man.
It takes him into all kinds of adventures, modeled after movies or novels, such as war, a court room drama.
In these fantasies, Mitty is a hero.