“There is something deeply and indefinably interesting in the swinish race,” the novelist Nathaniel Hawthorne wrote, in 1841, from Brook Farm, the Massachusetts commune where he was helping to care for pigs and other livestock. “They appear the more a mystery, the longer you gaze at them; it seems as if there was an important meaning to them, if you could but find out.”

A viewer of Shane Carruth’s new movie “Upstream Color” may come away with a similar feeling. In Carruth’s movie, two lovers are mysteriously linked to each other, and to two pigs. The lovers may even care a little more for the pigs than for each other. The nature of the link is so gruesome that I spent a fair part of the movie’s first twenty minutes yelping, writhing in my chair, and covering my eyes—to the mortification, I suspect, of the other patrons in the movie theatre, who took in the scenes with the equanimity typical of supercool Williamsburg. If, like me and unlike hipsters, you’re squeamish about subcutaneous creepy-crawlies and the erosion of the self, exercise caution.

My delicate stomach notwithstanding, I was eager to see “Upstream Color.” Like many, I had been won over by Carruth’s 2004 movie, “Primer,” which, on a budget of seven thousand dollars, depicted engineers in their twenties trying to create a start-up in a garage and inadvertently discovering time travel. The dialogue of “Primer” featured bits of real math and physics, which contributed unnervingly to the movie’s realism, and the plot was so dense with crisscrossing and diverging timelines that more than one person on the Internet felt obliged to draw a chart.

Carruth’s new movie—once again he writes, directs, scores the music, and acts, and once again he has done it all completely outside the Hollywood system—is about biology the way that “Primer” was about time travel. It has more of the texture of science than your average sci-fi movie does, and much more philosophy. The last half-hour or so of “Primer” wasn’t parsable without repeat viewings and many consultations of Google, but leaving the theatre after “Upstream Color,” I felt reasonably confident that I understood what had happened, plotwise. “But what’s it about?” my husband asked. I felt much less sure about that, but as I thought it over in the days that followed, and as I pulled a few transcendentalist classics off the shelf, I began to wonder if I’d been watching a movie by the premier Thoreauvian of our time. (Spoiler alert: I’m not sure “Upstream Color” really can be spoiled by the revelation of its plot, but if you don’t want to know it, better stop reading here.)

* * *

Carruth seems to have been inspired by parasites that highjack their hosts’ nervous systems, such as the protozoan Toxoplasma gondii, which impels an infected rodent to take risks that are likely to get it eaten by a cat, in whose guts the protozoan likes to have sex and reproduce. T. gondii infects humans and can alter their behavior, too, perhaps triggering schizophrenia in some cases. (On the glass-half-full side, some have speculated that T. gondii infection may give an advantage to a country’s soccer team, perhaps by fostering boldness.) T. gondii is not the only little beastie that engages in mind control. “Have you heard of these parasites that infect the brains of wasps and make them fly erratically?” Carruth recently asked an interviewer from Indiewire’s Playlist. “And ants as well.”

In “Upstream Color,” the hero is a parasitic worm. (The role seems to have been played by a mealworm, the pale, segmented larva of a common beetle.) We first see it being shaken out of the root bundle of an orchid by someone identified in the credits as “the Thief,” who has detected the worm’s presence by a telltale blue scale on the orchid’s leaves. Teens help the Thief find such orchids; the teens’ reward is Diet Coke that a larva has percolated in, a shared swig of which seems to impart the power to synchronize their movements even with closed eyes. In the hands of the Thief, the neurotoxin is put to a more practical use. Outside a nightclub, he assaults a woman named Kris (played by an exquisite Amy Seimetz) and, using a plastic medical device, forces a worm down her throat in order to brainwash her. Once she’s under the worm’s spell, he tells her that she’s unable to look at him because his head is made of the same substance as the sun and commands her to turn the equity in her house into cash, which she surrenders along with a strongbox of precious coins. To stall her while he works, and then while he makes his getaway, the Thief also imposes elaborate and apparently nonsensical tasks, including the transcription and memorization of Thoreau’s “Walden.”

Once the Thief has his loot, he leaves the worm to its own devices, still inside of Kris. She tries stabbing holes in herself, which doesn’t help the worm emerge. Fortunately for Kris and the worm, a person identified in the credits as “the Sampler” has somehow figured out that people infected with worms are attracted to an amplified raspy thumping sound, which he plays through speakers aimed into the earth late at night in a rural field. Or maybe it’s the worms trapped in the people who are drawn to it. In any case, Kris and her worm obey the summons, and the Sampler coaxes the worm out of her and into a porker lying on a parallel gurney, in a nightmare version of the famous Disney scene of Lady and the Tramp sharing a plate of spaghetti. Afterward, the viewer sees what seems to be Kris in a hospital gown wandering through a camp full of other silent, zombified humans. The scene is a trick, I’m pretty sure: I suspect we’re looking not at Kris but rather at the pig, who’s now the host of Kris’s worm and therefore is trailing Kris’s psychic aura. If my suspicion is correct, the other apparent people in the scene are the pig’s pen mates, which appear human to the pig thanks to the auras given off by the worms inside of them.

Kris wakes up in her car and wobbles back to her ruined life. She’s penniless, and her several-days absence without leave has cost her her job. She can’t remember the Thief or the Sampler. In her attempts to reconstruct what happened, her only clues are a few odd, repetitive habits she has acquired, which seem to be traumatic residue from the tasks imposed on her by the Thief, and an uncanny involvement with Jeff (played by Carruth), a man she meets on a commuter train who seems to have gone through a similar ordeal. She ends up attributing her misfortune to a psychiatric condition. For his part, Jeff, a former broker, has decided that it must have been substance abuse that led him to embezzle from his clients. They fall in love. The viewer soon realizes that they are falling for each other in large part because the pigs carrying their worms are also growing attached. After a first night together, the human lovers appear sprawled the next morning on sheets draped over the dirt floor of the pigpen. Are we seeing humans sensing the farm through their occult connection to pigs, or are we seeing pigs mistaking their bestial romance for a human one?