In the main plot, Duke Orsino uses the shipwrecked Viola, who is disguised as a man named Cesario, to help him woo the Countess Olivia. However, comic mayhem follows as Olivia instead falls in love with Cesario, not realizing, of course, that "he" is really a woman. That wasn't supposed to happen. Meanwhile Cesario/Viola falls in love with the Duke. So a woman falls in love with a woman disguised as a man, and a woman disguised as man falls in love with a man. It doesn't get much more gender bending than this. As Shakespeare said in another play, the course of true love never did run smooth though, this being a comedy, everything sorts itself out in the end.
The subplot involves servants. Olivia's servant Maria, called her "woman," wants revenge on Olivia's steward Malvolio, who has an inflated ego. Maria plays on this weakness, dropping love letters to him that are supposedly by Olivia. A steward with a more realistic self image would realize that a countess wouldn't fall in love with him, but the foolish and self-infatuated Malvolio falls for the scheme.
As is often the case in Shakespeare, the main plot involves highborn or aristocratic characters and the subplot lower-class characters. The subplot is linked to the main plot through characters such as Olivia but, more importantly, through the common themes of love, lunacy, and deception. Malvolio may be the one jailed for lunacy but, Shakespeare asks, isn't any form of love a kind of self-deceiving madness?
The main-plot of Shakespeare's comedy Twefth Night is the one that concerns the royal life of the Illyrian court--the love-proposals between Orsino and Olivia with the disguised Viola as an interconnector, while the sub-plot or the under-plot concerns the low-life of Illyria---the festivities of Sir Toby, Sir Andrew and Maria.
The Renaissance theatre had a general penchant for the double-plots with reflective and contrastive links between them. Here also, the contrastive social strata divide the plots as it were, but as always in Shakespeare there is a unification of the two plots, which in this case might well imply a carnivalesque breakdown of social hierarchy.
It is the festive revelry of the Toby-Andrew-Maria trio that through the gulling-act of Malvolio, that brings together the two plots. Malvolio is a man who wants to promote himself to the royal stratum by marrying Olivia and his deception and unmasking are events that assemble and involve all the characters of the main-plot primarily through the go-between Feste and the disguised Viola.