c. 1300 (late 12c. as a surname), "base or low-born rustic," from Anglo-French and Old French vilain "peasant, farmer, commoner, churl, yokel" (12c.), from Medieval Latin villanus "farmhand," from Latin villa "country house, farm" (from PIE root *weik- (1) "clan"). Meaning "character in a novel, play, etc. whose evil motives or actions help drive the plot" is from 1822.
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]