Wrong Genetic Sex

Most people who have passed grade school know that men have one X and one Y chromosome while women have two X chromosomes. However, in Real Life it's not always that simple.

The whole issue of gender identity aside, anything that interferes with fetal development can cause various degrees of feminization or masculinization ranging from people who are genetically XY and physically female to people who are genetically XX and physically male to people who are intersex and whose anatomical sex is neither male nor female. There is also a phenomenon called chimerism which can cause different parts of the body to have different DNA, meaning DNA from someone's blood or saliva (the most common sources for DNA tests) may not match DNA from other parts of their bodies, which for fictional purposes usually means hair, skin or semen.

In fiction, this usually pops up in various kinds of detective stories and is used as a excuse to make a DNA test into a Red Herring. It can also be a source of drama or simply a character quirk. The actual cause is likely to be handwaved or just glossed over. Transsexuals are covered by their own trope, Transgender, but may also fall under Wrong Genetic Sex if their transgender status is not known in advance and the plot hinges on the difference between their chromosomes and their appearance. Intersex people may also be included under similar circumstances. However, only individuals count: If an entire population is intersex, then it's a One-Gender Race.

See also Hermaphrodite, which may overlap but is in many cases a distinct phenomenon. Both "hermaphrodite" and "pseudohermaphrodite" were used as medical terms for these conditions in the past but that usage was not strictly accurate and is now considered perjorative.

Anime and Manga

 * In The Day of Revolution, the supposedly male protagonist discovers in the first chapter that he is intersexed and genetically female. Despite some misgivings and with a push from her parents she decides to reinvent herself as a girl. Hilarity Ensues.
 * In Earth Maiden Arjuna, one of the female ecology activists has this, with the implication that it was the result of the polluted environment.
 * Kyoko, the protagonist of one of the arcs of Level E, is found to be one, Unfortunately, that might spell the end of Mankind (long story).

Literature

 * The protagonist from Robert Heinlein's All You Zombies, who starts out as an intersex female and...it gets complicated. Her actual degree of intersexualization approaches true hermaphrodism and isn't biologically possible.
 * Calliope (later Cal) from the book Middlesex was born intersex (genetically XY) and raised female until the age of fourteen.
 * Cal also meets a woman with Androgen insensitivity syndrome, which basically means she's genetically male with the body of an infertile female. Despite being able to come across as a woman, she strongly identifies herself as a Hermaphrodite and is an intersex rights activist.
 * The original incarnation of Sadako was this. In the book, a doctor was the guy who threw her into the well, because he found out.

Live Action TV

 * In one episode of Law and Order Special Victims Unit, the episode starts with a rapist getting killed by his victim and the DNA evidence leads the detectives to a teenage boy who just happens to have an ironclad alibi. It turns out his twin "sister" is actually his twin brother; it seems he lost his penis when they were circumcised as babies and the doctors who botched the operation covered their tracks by completing the job and talking his parents into raising him as a girl.
 * Sadly, this is actually Truth in Television: The episode is based on an actual case. Just like the character in the episode, the real man vehemently reverted to a male gender identity as soon as he got the chance. Sadly, the real man ended up killing himself.
 * In one episode of House, a woman turns out to be suffering from testicular cancer, due to a surprisingly common medical condition (especially among supermodels) that causes some people with XY chromosomes to develop into infertile women with internal testicles instead of ovaries.
 * This is a major plot point in an episode of Freaks and Geeks, when Ken's new girlfriend Amy tells her she's one of these. There was no DNA test or anything - the conflict came from Amy getting upset at Ken telling his friends her big secret.
 * In one episode of CSI, a DNA sample with female chromosomes turned out to belong to a male character. He was a post-operation trans man and it wasn't known that he had been born female-bodied.
 * In one episode of Anna & Kristina's Grocery Bag, Anna and Kristina couldn't figure out which part of their lobsters was the coral, which part was the roe and which were the "intestine-y bit(s) one should not eat" and Kristina asked if lobsters were hermaphrodite-both [male and female]. As it turns out, they needed female lobsters for their recipe but the cookbook they were testing did not divulge that detail.
 * In one episode of Whose Line Is It Anyway?, during a game of Party Quirks, Colin was playing a character who suspected that people were not the gender they purported themselves to be and he spent his time during the game feeling up his fellow contestants.

Real Life

 * Chimerism has been found to be the cause of rare—sometimes, seemingly impossible—coat colors in several species of animal, including dogs, cats, and horses. One particular horse appeared to be a stallion, but was found to have a blend of stallion and mare DNA; many calico tomcats are the feline equivalent.
 * The human body is physically female by "default" during the very early stages of development; and what turns that female body into a male body is the action of testosterone in the womb, however, there's a rare condition called Androgen Insensitivity Syndrome in which a resistance to testosterone causes a person with one X chromosome and one Y chromosome develop as a female (although sterile). South African middle-distance runner Caster Semenya is likely the highest-profile example because of her notability as an athlete.