After publishing his first novel, The Virgin Suicides, in 1993, Jeffrey Eugenides started on his next project Middlesex. His source of inspiration was Herculine Barbin, the diary of a 19th-century French convent schoolgirl who was intersex. Eugenides had first read the memoir a decade earlier and believed it evaded discussion about the anatomy and emotions of intersex people. He intended Middlesex to be "the story [he] wasn't getting from the memoir".
Eugenides worked on Middlesex for nine years. He started writing during his short term residence at MacDowell Colony in New Hampshire, United States,[note 2] and finished the novel in Berlin, Germany; he had accepted a grant from the German Academic Exchange Service in 1999. Eugenides spent the first few years trying to establish the narrative voice for his novel. He wanted to "[tell] epic events in the third person and psychosexual events in the first person". According to Eugenides, the voice "had to render the experience of a teenage girl and an adult man, or an adult male-identified hermaphrodite".
Although Eugenides sought expert advice about intersex, sexology, and the formation of gender identity, he refrained from meeting with intersex people, saying, "[I] decided not to work in that reportorial mode. Instead of trying to create a separate person, I tried to pretend that I had this [physical feature] and that I had lived through this as much as I could". Eugenides read books, sifted through many sheets of microfiche, and combed through videotapes and newsletters that dealt with the subject. He visited the New York Public Library's Schomburg Center for Research in Black Culture to search for the sole copy of a book about an "elusive historical figure". He discovered details of what he considered a vivid intersex condition while browsing Columbia University's medical library.
After discovering in his library research 5-alpha-reductase deficiency, an autosomal recessive condition manifested primarily in inbred, insulated population groups, his perception of the novel significantly changed. Rather than a "slim fictional autobiography" of an intersex individual, the novel would be epic in scope, tracing the lives of three generations of Greek Americans. Eugenides lived in Brooklyn when he began his first draft of the novel. He went through a lengthy brainstorming process. He would write 50 pages in one voice, restart in a different voice with 75 pages, and then pursue a different narrative angle. He wanted the novel to be an "intimate" portrayal of protagonist Cal's transformation, so he wrote a draft in the first-person narrative in Cal's voice. He could not, however, portray Cal's grandparents intimately, so he completely abandoned his preceding year's draft in favor of writing the book in the third-person. He gradually violated his narrative convention by restoring the first-person voice amidst the third-person narration to depict the mindsets of both Cal and Cal's grandparents. During the writing process, Eugenides moved from Brooklyn to Manhattan and later returned to Brooklyn. Worried about the narrative's sounding forced, he added instances of "self-reflexivity" to Cal's voice. After several years of struggling with the narrative voice, Eugenides finally seated himself at his desk and penned Middlesex 's initial page, "500 words that contained the DNA for the protein synthesis of the entire book".
Middlesex was published for the North American market in September 2002 by Farrar, Straus and Giroux in the United States and Vintage Canada for Canada. A month later, it was released in the United Kingdom by Bloomsbury Publishing. The novel has been translated into 34 languages; the Spanish-language edition was translated by Benito Gómez Ibáñez and released in 2003 after the publisher, Jorge Herralde, had acquired the rights in a "tough auction".