Ernst, 36, who was a director and producer on the Amazon series “Transparent,” said in an interview that he was skeptical of the novel’s premise initially. Ernst said he feared that the film was intended to be laughed at by straight viewers — a comedy of errors reminiscent of “Twelfth Night” or “Tootsie” that swaps gender identity rather than plain old gender.

But Ernst said the script surpassed his expectations. “I found it to be incredibly subversive and surprising and hilarious,” he said. “It was a challenging story, but I felt like I could thread the needle.”

In one scene, Adam is attending Camp Trans, a gathering established to protest the exclusion of transgender women at the Michigan Womyn’s Music Festival. The Camp Trans participants are mostly transgender and non-binary. While they splash joyously around a swimming hole, Adam cowers on the grass — fully clothed, because he doesn’t want Gillian to see his cisgender body.

“I wanted to show a scene where a straight cis person has to sit there clothed, ostracized,” Schrag said. “You see all these movies and read all these stories where it’s like the lone queer or trans person trying to fit into the cis world,” she added. “That wasn’t my experience — I’ve led a wonderful queer life.”

Schrag, 39, said she grew up in Berkeley, Calif., where having girlfriends in high school was not an issue. Much of the social milieu depicted in “Adam” was true to her life in the Bushwick neighborhood of Brooklyn in the mid-2000s, Schrag said. There was the Hole, a boisterous lesbian bar; Bound, a women-only club known for its sex parties; and living-room watch parties of the Showtime lesbian drama “The L Word,” for which Schrag eventually wrote. Ernst was part of that same social scene.

Some on social media asserted that it was problematic for a lesbian to be interested in a transgender man, the implication being that trans men are merely lesbians “playing dress up.” But Schrag and Ernst say that these relationships were true to their social scene in 2006, the year that the story takes place.