At the beginning of Twelfth Night, Viola disguises herself as a man named Cesario when she finds herself marooned in the foreign land of Illyria. She does this for the standard reasons common to Shakespeare's cross-dressing heroines: to protect herself from sexual predators and to give herself more opportunities to support herself that she would be denied as a woman. However, once Viola starts working for Duke Orsino, her disguise takes on further complications, raising questions about the nature of identity.
Viola's disguise complicates her love life: she yearns for Orsino, but as Cesario she must pretend not to feel as she does. Instead, she is told to woo Olivia in Orsino's stead and gains Olivia's romantic affection for her pains. She becomes trapped in her disguise, which threatens to swallow up her original Viola identity and destroy her hopes for romantic union with Orsino.
Other characters don disguises as well. For example, Feste dresses as a priest coming to visit the "mad" Malvolio when Sir Toby and Maria lock him up. This is part of the ploy to convince Malvolio he is going crazy and does not realize it, to erode his sense of identity as a sane person. Like Viola's Cesario identity, Feste gains power when he puts on the priest disguise, almost as though clothes matter more than what is inside a person when it comes to social respect. This carries over into love as well when Olivia marries Sebastian, believing he is Cesario, then does not regret her choice when the truth is revealed. In Twelfth Night, the extensive use of disguise suggests identity in this world lays more in how society perceives one's identity than anything else.