In Twelfth Night, why does Viola have to wear clothes like her brother?
It is important to recognise that Viola is not forced or compelled to wear man's clothes and to disguise herself as if she were a male. This is a choice that she makes, partly to protect herself and partly to enable her to gain employment in the court of Orsino. This is explained in Act I scene 2, where Viola and the Captain find themselves swept up on the coast of Illyria and she has to decide what to do with herself. Viola is in rather a precarious position: she does not know what her position is and she decides to disguise herself in order to take time to work out where she stands in this foreign land, and also to try and help Olivia, whom she has heard about from the Captain. This is what is behind her decision to disguise herself as a man:
Conceal me what I am, and be my aid
For such disguise as haply shall become
The form of my intent. I'll serve this duke:
Thou shall present me as an eunuch to him...
Viola does not therefore consciously disguise herself as her brother. She thinks Sebastian is dead, which leads the humorous and comic confusion that descends on the play later on which is unintentional. Mistaken identity is a key motif of Shakespearian comedies, and Viola's decision to disguise her identity, which is made to give her more time to assess her situation, unwittlingly plays into the comic confusion of the play.