There a two specific ways in which "playing" a man gives Viola insight into herself.
The first is that, by playing the part of Cesario, she is able to have access to Orsino that she would be denied as a woman. Shakespeare lived and worked in a time when especially high born men and women had to follow many strict rules about spending time together. Spending time alone together would have, generally, not been possible for an unmarried man and woman. So, Viola, as Cesario, is given the rare chance to simply "hang out" with Orsino and have a regular, "man to man" chat with him. This access allows her to develop real feelings for a man she has come to know, rather than rely on love from a more superficial distance.
Secondly, her interactions with Olivia allow her to stand outside the female experience and witness it as an observer. By witnessing Olivia's love for her, she can experience, albeit secondhand, a woman's expressing her love to the man she desires. Viola, constrained by her disguise, cannot tell Orsino of her love, so it is possible that she sees and understands her own womanly feelings better through her interactions with Olivia.
There is also the view that in Twelfth Night, because Viola gets to be both male and female, she gets to be more whollyherself because at the end, having had people know her as both genders and having different view points of her at different times (Olivia was in love with her, perhaps knowing she was a girl, Orsino was in love with her, liking her masculine features, and her brother knew her as his sister, his twin), it can be argued that she surpassed gender all together. The people who loved Viola loved her for who she is, not her gender. The way she acted both as a man and a woman had qualities of both genders.
Viola is wholly herself by the end, not really constrained by either gender and then in the unique position to shed the roles of each gender that she did not like.