Figuratively, someone who takes a contrary position for the sake of testing an argument, or just to be perverse.
The original Devil’s Advocate was a real person with a real job.
During the canonization process employed by the Roman Catholic Church, the Promoter of the Faith (Latin: promotor fidei), popularly known as the Devil’s advocate (Latin: advocatus diaboli), was a canon lawyer appointed by Church authorities to argue against the canonization of a candidate. It was this person’s duty, no matter what his personal opinion might be, to take a skeptical view of the candidate’s character, to look for holes in the evidence, to argue that any miracles attributed to the candidate were fraudulent, and so on. The Devil’s advocate opposed God’s advocate (Latin: advocatus Dei), whose task was to make the argument in favor of canonization. During the investigation of a cause, this task is now performed by the Promoter of Justice, who is in charge of examining the accuracy of the inquiry on the saintliness of the candidate.
The office was established in 1587 during the reign of Pope Sixtus V. The first formal mention of such an officer is found in the canonization of St. Lawrence Justinian under Pope Leo X (1513–21).
The first time that the current form of the expression was used in print appears to be in the 1760 humorous text Impostors Detected:
“By rising up and playing the true part of the Devil’s advocate.”
It seems likely that the position was created to spare the Church any embarrassment from canonizing someone with unrecognized faults. This was the time of Machiavelli and short terms in the Papacy, so any embarrassment could prove fatal. Despite the loss of unconditional acceptance, it was more important to have a full and complete investigation of the good and ill of the lives of nominees before accepting them.
Outside the Church, of course, some people play ‘devil’s advocate’ just for fun, or to be mischievous. Formal debates will have advocates arguing against each other, sometimes for the exercise, rather than because they believe in their own arguments.
At this moment, on a rainy, cold weekend, I’m advocating for a warm chocolate brownie. It seems unlikely that I’ll get any argument about that.