The film received two Silver Bears at the 62nd Berlin International Film Festival, and was nominated for the Academy Award for Best Foreign Language Film at the 85th Academy Awards. It was also nominated for the Best Foreign Language Film award at the 70th Golden Globe Awards.
Princess Caroline Matilda of Great Britain is shown writing a letter to her children in which she professes to tell them the truth. In flashback, Caroline talks of England, as she was about to leave to marry Christian VII of Denmark. She is passionate about the arts and education, but when she arrives in Denmark she is told that many of her books are banned by the state. Christian is mentally ill and Caroline is unhappy in the marriage. She is soon pregnant with a son (Frederick VI of Denmark), but the couple grow far apart and the king stops visiting her bedroom.
The German doctor Johann Friedrich Struensee is recruited to work as the king's personal physician. Struensee is a man of the Enlightenment, greatly influenced by the writings of Jean-Jacques Rousseau. He keeps this secret from the state, who welcome him because his father is a well-known priest. King Christian takes a strong liking to Struensee and he becomes a close friend and confidant. When Struensee manages to inoculate Prince Frederick against a smallpox epidemic, he becomes greatly respected in the court. Christian has very little influence in the Privy Council, and the laws of the country are mostly decided by statesmen, but Struensee tells the king that he can have more power by "acting". The doctor begins writing speeches for the king which advocate his own progressive views, and several reforms are passed in Denmark.
Caroline and Struensee learn of their mutual interests and liberal views. They fall in love and begin an affair. When Caroline becomes pregnant, they protect themselves by convincing Christian to resume sleeping with her. As a result, Princess Louise Auguste is believed to be the king's daughter. Meanwhile, Struensee is appointed a Royal Adviser and eventually persuades Christian to assign him the right to pass any law, making him Denmark's de facto leader. His reforms include the abolition of censorship, the abolition of torture, and reducing the power of the aristocracy. The queen dowager, Juliana Maria of Brunswick-Wolfenbüttel, notices the romance between Caroline and Struensee and their affair is revealed. Christian is initially angry, but he forgives his friend and states that they must carry on as if nothing had changed.
Juliana and the prominent statesman Ove Høegh-Guldberg are strongly against Struensee's reforms, while the Danish people also grow unhappy when it becomes clear an immoral foreigner has power over the country. Høegh-Guldberg incites a coup against him. Christian refuses to hand Struensee over to the people, but Høegh-Guldberg lies that the doctor and Caroline are planning to murder him and take control of Denmark. Christian thus allows Caroline to be arrested and taken to live in exile, while Struensee is sentenced to death. Christian issues a pardon, not wanting his friend to die, but Høegh-Guldberg keeps this from becoming known in time and Struensee is beheaded. Høegh-Guldberg becomes Denmark's new de facto leader, and many of Struensee's reforms are overturned.
The film returns to Caroline writing the letter, where she reveals that she is dying of an illness. Ten years later, Prince Frederick and Princess Louise Auguste read the letter. On-screen text reveals that when he became king, Frederick returned to the reforming ways of Struensee.
Nikolaj Arcel and Rasmus Heisterberg started the writing process by reading the 1999 novel The Visit of the Royal Physician by Per Olov Enquist, which is based on the events surrounding Johann Friedrich Struensee's time at the Danish court. The exclusive film rights for the novel were already sold to a company which had been struggling for over a decade to make a large-scale adaptation in English, and did not want to sell the rights to Zentropa. Research continued and the film was eventually credited as based on Bodil Steensen-Leth's erotic novel Prinsesse af blodet, which tells the story from the perspective of the queen, Caroline Mathilde. The film's perspective and characterisation did still remain highly influenced by Enquist's version, in particular in the portrayal of Struensee as an idealistic promoter of freedom of speech, the romantic view of the royal court as an ironical charade and the role of the queen as a revolutionary partner-in-crime to Struensee. To avoid conflicts about rights, Enquist was contacted to clarify some instances of what he had made up and what was based on documented events, and a person was employed specifically to compare the screenplay and the novel to guarantee that they were dissimilar enough.
The film was produced by Zentropa and is a co-production among Denmark, Sweden and the Czech Republic. It had a budget of 46 million Danish krone (US$8.406.127,40). Before settling on the final title, the film had the production titles Dronningen og livlægen ("The queen and the royal physician"), based in part on the title of Enquist's book, and Caroline Mathildes år ("Caroline Mathilde's years").
The film received critical acclaim. Review aggregation website Rotten Tomatoes gives the film a score of 89% based on 100 reviews, with an average rating of 7.3/10 and the summary, "A Royal Affair is a lavish and sumptuous costume drama with a juicy story to back it up." Metacritic gives a weighted average rating of 73 based on reviews from 27 critics, indicating "generally favorable reviews."
British Film Critic Mark Kermode tied the film as the Best Film of 2012 along with Berberian Sound Studio.
Historian Alfred Brown notes that the film depicts Struensee as speaking fluent Danish, when in fact he did not speak it and persistently used German, which helped alienate him from Danish society. Brown also notes that "The exiled Queen's letter to her children makes a good frame story to the film, however had she in reality written such a letter –frankly admitting Princess Louise Auguste's true parentage– it might have easily fallen into the wrong hands and caused the young princess to be declared a bastard".
At the Berlin Film Festival, Mikkel Følsgaard won the Silver Bear for Best Actor and Nikolaj Arcel and Rasmus Heisterberg won the award for Best Script.