"The most important phases of the sense development of this word may be summed up as follows: 'inhabitant of a farm; peasant; churl, boor; clown; miser; knave, scoundrel.' Today both Fr. vilain and Eng. villain are used only in a pejorative sense." [Klein]
Meaning "character in a novel, play, etc. whose evil motives or actions help drive the plot" is from 1822. Villainous is recorded from c.1300, from O.Fr. vileneus; villainy (early 13c.) is from O.Fr. vilanie.