Malvolio is rude for several reasons. First is his innate character. He's a snob, and thinks he is better than he is. Second, some of the others are rude to him. I mean, look at how Sir Toby acts! He stumbles around drunk, is loud, crude, etc. This leads into a third reason. Malvolio is a bit prissy. Part of that is how he thinks he should act, as an aspiring member of the upper class, but some is just him. When Toby is crude, that grates on him. And a final reason is more writerly: "mal" means "bad," as in "malicious." "-vol" is related to will, like "volition." Shakespeare sets him up as someone who wants to do bad to other people. He's drawn to be mean.
Malvolio is the steward of Olivia's household, as such it is his responsibility to supervise the servants like Maria and Fabian. In order to emphasise his superiority over them, he bosses over them and is always rude to them. Maria ofcourse, resents this and it is she who devises the plan to deceive and humiliate him, "for monsieur Malvolio let me/alone with him: if I do not gull him into a/nayword, and make him a common recreation." ActII sc3.
Even though Malvolio knows that Sir Toby is the uncle of Olivia he is always rude towards him because Sir Toby is a freeloader who takes advantage of his niece's generosity and invites Sir Andrew Aguechek to be his guest in her house. Malvolio being a puritan stongly objects to Sir Toby's drunken behaviour, "do ye make an/alehouse of my lady's house?" ActII sc3. Consequently he succeeds in earning Sir Toby's wrath- "Art any more than a steward? Dost thou think because thou art virtuous, there shall be no more cakes and ale?"
Malvolio is rude to Feste because he is jealous of his witty intelligence and puritan that he is, he resents the fact that Feste makes a living out of literally 'fooling' around. In Act I Sc 5 he objects to Olivia's reinstatement of Feste,"I marvel your ladyship takes delight in such a/barren rascal."
Shakespeare has introduced Malvolio in the play mainly to satirise the Puritans who were not only killjoys but also selfrighteous hypocrites.