This is a real story from history, so much as anything is. Pronouns are a tricky business at some times, and it is unclear how the Chevalier would map into the modern conception of sexuality, and many . Throughout this piece, the Chevalier will be presented as "he" during the periods where he presented publicly as male, and "she" during the periods where she presented publicly as female.
The infamous Chevalier D'Éon was known by this shorthand name probably to save time. The full name is so long and complex that I'm not even going to bother writing it, instead I'm just going to copy-paste and call him/her Chevalier for the rest of the article. The full name was Charles-Geneviève-Louis-Auguste-André-Timothée d'Éon de Beaumont. Quite the mouthful eh?
Active during the late 1700s and early 1800s, the Chevalier was one of the deepest cover spies of an era. For 49 years, he appeared as male in public, though during that time he successfully infiltrated the court of Empress Elizabeth of Russia by posing as a woman. However, from 1777 for the remaining 33 years of his life, (s)he presented as a woman and claimed that she had been a woman since birth. After death, doctors examined the body and declared that the Chevalier was male at birth due to "perfectly formed genitalia", though they also commented on well formed breasts.
So, talking about gender aside, we have an individual who is one of the most bad ass spies in history. In 1756, Chevalier joined a secret society of spies that worked for the French King, unbeknownst to the rest of the French government. After a series of early missions against the Hapsburgs (according to the Chevalier; there's a lack of corroborating evidence), off to Russia he went. Within the Russian court, D'Éon navigated with aplomb and became the maid of honour for the Queen of Russia, serving as a powerful source for the French. With time, D'Éon became the French ambassador to Russia, continuing to develop those connections and intelligence.
After the death of Elizabeth of Russia, however, D'Éon was recalled to France. After a brief stint of serving as a dragoon in the French military. Eventually sent to London to serve as a part of the representatives there, he was quickly embroiled in scandal. The Madam de Pompadour and the comte de Broglie represented two different groups who had an interest in these operations. Trapped between them, D'Éon was demoted and humiliated in his operations.
It was also during this period that the speculation began that D'Éon was a woman. At one point, there was a bet on the London Stock Exchange about the sexual status of the Chevalier. When invited to answer the question once and for all, D'Éon declined.
By 1774, when the King died and the spy ring was abolished, D'Éon tried to negotiate a return to France. This begins much of the conversation and speculation about D'Éon's status in terms of gender. Some observers in the era suggested that D'Éon only claimed to be a woman in 1777 for the purpose of being able to return to France, as women of the era could be forgiven for any number of things. The claim was made that D'Éon was born as a woman and raised as a man, though whether this was solely to return to France or not is questionable.
The new King allowed D'Éon's return, but only under the condition that clothing be worn in accordance with the gender being claimed. There was a negotiation about who would pay for this, and eventually the King agreed that he would, and D'Éon would be able to wear the award that had been previously bestowed for service.
The French revolution led to an ignominious end for the amazing D'Éon. The pension was revoked, and ultimately she was forced to live in poverty after selling off her remaining belongings. She made a living as a fencer until she was wounded and unable to continue. During this shining period, however, she was known to undertake a number of public events and an image was made in her honour, portraying her as Minerva. She would go on to be sent to debtors prison, then live with a widow. D'Éon suffered from a nasty fall and was left bedridden for the final four years of her life, until dying at the age of 81 in 1810.