From the Medieval Latin villanus, which itself comes from Anglo-French vilain, meaning peasant or farmhand. It is derived from the Proto Indo European root weik, meaning clan.
Circa 1300, Villain was a surname that indicated one born of a low status, as a serf tied to farm land. Villain referred to one of a low status that is bound to a villa, which is Latin for farm or country house. It took on the connotative meaning of "evil character" because it represented a person that was not a knight, and thus thought to be unchivalrous. They then were labeled as evil and thought to do such heinous acts as theft, rape, and murder; it is said that the conditions they lived under forced them to resort to crime. Thus, anyone who was a villain was viewed suspiciously and thought to be a dangerous criminal.
This type of semantic shift is considered a transfer of meaning in which the word villain has taken on a new meaning all together. This change also occurred with the Dutch word boor (a farmer or peasant) and Old English/Saxon word churl (a man of the lowest rank); today, both refer to a rude, surly, sullen, coarse, or ill-mannered person. Villain begins to shift in meaning a sinister is first attested to mean an evil character in 1822. As churl and boor are of Germanic origin, and villain shifts as it enters the English lexicon, one can get a sense of the social and political climate during that point in history. Much as today, those of lower status are "villainized"...that is, made out to be seen as a scoundrel, rude, uneducated, etc... The churl, boor, and villain all experience a degeneration or pejoration, where a word takes on an unfavorable shift change.