In “Constellations,” two people, Roland (Jake Gyllenhaal) and Marianne (“The Affair’s” Ruth Wilson), play out their relationship again and again in what’s known as a multiverse—a hypothetical reality in which there are an infinite number of universes in which an infinite number of us exist, each living out a different version of our lives. To make such a theoretical premise clear on paper, playwright Nick Payne used three different fonts in the script—bold, italic, and normal—to denote that Roland and Marianne have switched to a new universe.

“A lot of people read [the script] and have lots of questions,” says Mr. Gyllenhaal, who took classes in Eastern religion at Columbia University, “and some people say, ‘Oh, I get it.’ I got it.”

“Constellations,” which opens Jan. 13 at the Samuel J. Friedman Theatre in New York City, plays out like a long episode of déjà vu. When Mr. Gyllenhaal and Ms. Wilson meet in the first scene, their interaction repeats in five different ways. In some versions, or “universes,” Mr. Gyllenhaal has a girlfriend already and the conversation ends abruptly. In another version he’s just not interested. And then in one version, he really likes Marianne and she him, and a match is made. The play continues in this stuttering manner for seven more scenes, each containing new endings for the characters.

The personalities of Roland, a beekeeper, and Marianne, a theoretical physicist, stay essentially the same, and they say essentially the same lines to each other scene after scene, with slight shifts that will veer their lives into dramatically different directions. A single word, or even a punctuation mark, ends up changing the outcome of the scene.

“They’ve learned the script to the comma,” says Mr. Payne of his actors. “There are nights when I watch it and I can see the text on the page when they’re saying it.”