Malvolio is the steward (head servant) to Lady Olivia. He's a big time hater and criticizes just about everything – Toby's partying lifestyle, Feste's licensed fooling, and all other forms of fun. His party-pooper ways and constant tattle-telling place a big giant bulls-eye on his back – he's just asking for trouble. And that's exactly what he gets when he's duped into behaving like a "madman" to win the favor of Lady Olivia.
Maria says that "sometimes he is a kind of puritan" (2.3.139), which aligns Malvolio with the religious group despised for its opposition to the theater, winter festivals, and other forms of entertainment (just about everything Twelfth Night celebrates). Malvolio's not a Puritan, per se, but the fact that the play aligns him with the sect and goes out of its way to stage his humiliation makes Malvolio's disgrace an important part of the play's rebellious, nose-thumbing spirit.
Puritans were also accused of being power hungry and Malvolio's secret social ambitions fit the bill. When we catch Malvolio daydreaming about marrying Countess Olivia, we learn that his desire has less to do with love than it has to do with his aspirations for social power. What does Malvolio's power fantasy look like? Well, it involves wearing fancy clothes, bossing around the servants, and playing moral cop to Sir Toby's bad guy. Malvolio seems to be punished as much for his moral haughtiness as for his social climbing fantasies, which makes him central to the play's concern with the dangers of social ambition.
Modern audiences often find Malvolio to be a sympathetic figure. Sure, he's annoying and he gets what he deserves when Toby and company lock him up in a dark room and perform a mock exorcism, but Malvolio's circumstances make us uncomfortably aware of the sheer cruelty of treating a person like a madman for a few laughs. In fact, the play raises the point that the trick is like a bear-baiting, an Elizabethan blood-sport that involved chaining a bear to a post and setting a pack of dogs on it. In this sense, Malvolio's comeuppance is a bit like what happens to Christopher Sly in The Taming of the Shrew. Malvolio and Sly are both abused for the entertainment of others – including Shakespeare's audience, which finds itself in cahoots with the pranksters.