In Shakespeare's, Twelfth Night, Viola disguises herself as a male to be safe in the town because she had been shipwrecked and was single.
This seems to work out for her until her twin brother returns and people are getting confused.
Gender-bending in the play adds to the picture people have of women because woman were not allowed to act in plays so young boys played the roles as the younger women. Viola is played by a young boy dressed as a girl pretending to be a boy.
This can be funny to the people watching the play because they know that Viola is actually a boy.
In order to get what Viola wanted, she had to become a man and create some awkward situations, like with Olivia. Viola seems to get lucky when her twin brother comes to town.
The 17th century was a time when women were believed to only be capable of being housewives so Viola proves herself to Duke Orsino.
Though it may be very confusing, but gender-bending was Viola's way to prove that women could do the jobs that men could do.