mid-12c. "grant, commission" (recorded earlier in Old English, but as a Latin word), from Old French privilege "right, priority, privilege" (12c.) and directly from Latin privilegium "law applying to one person, bill of law in favor of or against an individual;" in the post-Augustine period "an ordinance in favor of an individual" (typically the exemption of one individual from the operation of a law), "privilege, prerogative," from privus "individual" (see private (adj.)) + lex (genitive legis) "law" (see legal (adj.)).
From c. 1200 as "power or prerogative associated with a certain social or religious position." Meaning "advantage granted, special right or favor granted to a person or group, a right, immunity, benefit, or advantage enjoyed by a person or body of persons beyond the common advantages of other individuals" is from mid-14c. in English. From late 14c. as "legal immunity or exemption."
Formerly of such things as an exemption or license granted by the Pope, or special immunity or advantage (as freedom of speech) granted to persons in authority or in office; in modern times, with general equality of all under the law, it is used of the basic rights common to all citizens (habeas corpus, voting, etc.).
Privilege is also more loosely used for any special advantage: as, the
privilege of intimacy with people of noble character.
Prerogative is a right of precedence, an exclusive privilege, an official right, a right indefeasible on account of one's character or position : as, the Stuart kings were continually asserting the royal
prerogative, but parliament resisted any infringement upon its
privileges. [Century Dictionary]
Middle English also had pravilege "an evil law or privilege" (late 14c.), from Medieval Latin pravilegium, a play on privilegium by substitution of pravus "wrong, bad."