Last fall, Matthew Weiner was walking on the Upper East Side of Manhattan when he saw a teenage girl having a tense conversation with a companion near a building under construction.

Mr. Weiner, creator of the AMC drama “Mad Men,” was carrying the notebook he always keeps with him to record snippets of overheard dialogue or a fleeting idea for a scene. He scribbled down a short note about the girl, and the unsettling sense he had that she was in some kind of “animal danger.”

He wasn’t sure what, if anything, would come of the idea.

“You don’t know if an idea is going to be a TV show or a movie or a play or prose or a poem or a stupid note you write in your notebook and forget about,” he said. “It was a little story where I was like, ‘I wonder what that is; maybe I’ll use it sometime.’”

During the next nine months or so, the little story grew into a novel, his first. “Heather, the Totality” was recently acquired by Little, Brown, which plans to publish it in the fall of 2017. Translation rights have sold in 10 countries.