The film begins on New Year's Eve, 1899, in London. Oswald Mandus, a wealthy industrialist and butcher, awakens from a fever that has lasted for several months, after returning from a disastrous expedition to explore Aztec ruins in Mexico. He can barely remember anything that's happened, but he starts hearing voices, young voices, and that sparks the memory of his sons; Edwin and Enoch. He tries calling for them but they don't answer, he tries following the voices as he thinks he sees them moving through many of the halls of the mansion. Always out of reach, and never hearing him no matter how much he calls for them.
As he moves through the house he starts finding notes, clearly written by him, yet they all seemed either old, or just fragments of bigger ones, all alluding to his previous life with his children, or the workings of some "Machine" that he apparently built under his home. From there he remembers about the death of his wife, and his relationship with his sons. He looks outside and finds factories, homes for the workforce, even a church near the factory...yet there are no people. It's already suspicious enough that he chose to have his home and factory be in the same place, but why is there no one-
The telephone device suddenly rings, startling him as he looks at it with suspicion, the ringing continuing on and on...
He picks it up, and is greeted by a man identifying himself as "the Engineer", who tells Mandus that Edwin and Enoch have been trapped far below them, in the "Machine" which Mandus created beneath his house. Mansus tries getting more information about him, about what is going on, but the Engineer does not answer, only continuing with his spiel; The Machine has been sabotaged, putting his sons in danger. The Engineer then says that Mandus has to clear the floodwaters and bring the Machine back online. After the call is cut off, Mandus is confused about what happened but puts it aside in order to find and protect his children once more.
He moves to the factory, thinking there must be an entrance through there, finding all the markings of regular industry, yet many things just seem off; from the signs that showed phrases more suited to a religious bent, but kept on emphasizing it in an unsuitable way, or the small notes he found in hidden areas, of workers discussing their conditions, or the different bent that religious service seemed to be taking. Finding his office, he encounters his journal, but what he finds there seems to have been destroyed or defaced, with only some information remaining; He seemed to be angry at God for some reason, and had decided to turn against him, building a new religion. information about his travel to Mexico with his children many years ago (Years? He'd thought it'd been weeks!) and the instructions about the Machine, as well as to where the entrance was.
Going down the tunnels, Mandus begins wondering about the construction, the intricacies of the machine, and finding the different acts of the "Saboteur" who may have endangered his children. So many different ways that the Saboteur acted, and many that he couldn't 't have found without the aid of the Engineer. It is odd that there are so many Telephone devices as well, but he assumes it must be for communication between all the areas in the factory, home and the Machine. As he keeps going down the path he finds more information about the living there, prayers for salvation, and even some drawings that bring to mind children going into the slaughterhouse. Mandus begins to think he must not have been a good man, and keeps on having hallucinations of his children just being there, calling to him, or out of reach.
Mandus also finds odd marks made by no human hand, as well as another journal hidden that seems to speak about the "Wretched" who came to work for him, and how he supposedly "Improved" or "elevated" them in a way that would further his designs. Through his movements, he hears huge...men? made of bulk and muscle, moving around, sniffing as if to smell him out. But he manages to escape at the last second. These things seem to just be there, doing what they do, and though he has an inkling as to what they may be, he makes sure to avoid them as much as he can.
After a series of tasks, Mandus eventually reactivates the Machine, but then the truth is discovered; the Engineer betrays him, taking control of the Machine and unleashing the creatures that Mandus had only seen in shadows or from afar; "Manpigs", deformed swine-like monstrosities that patrol the depths through which he descended, are now out in the streets of London, rounding up unsuspecting victims with which to feed themselves, and sent them back into the depths to serve as fuel for the Machine itself.
Mandus puts all the pieces together, and regains his memory, recalling the recent past: after returning from Mexico, Mandus was consumed with obsession over a vision of the future presented by a device discovered in an Aztec temple by him and his children, known as the "egg," hinted to be an Orb. In this vision, Mandus witnessed the death of both of his sons at the Battle of the Somme and was driven mad by it, decided that he could not allow it to come to pass, and built the Machine to create a godlike being via mass ritual human sacrifice to save humanity from its own carnage.
He sacrificed Edwin and Enoch to the machine to spare them their fate at the Somme. From there, Mandus began a one-man vendetta against mankind, holding massive parties where he would capture and grind up rich socialites into sausage to sell, and killing hordes of child workers to feed the captive Manpigs. Mandus, however, soon came to realize the error of his ways and in a bid to stop the Machine, he attempted to sabotage it, before he was hindered by the onset of amnesia and sickness.
Now remembering everything, Mandus vows to finish what he started by destroying the Machine once and for all. Despite the pleas of the Engineer, who believes the world would be better off if the Machine is allowed to consume it, Mandus succeeds in recreating most of the sabotage. He reaches the inner chamber, where the Engineer himself dwells - a deranged fragment of Mandus's soul which has bonded with the machine and was given life by the sacrifices; it plans to wipe the world clean of life after witnessing even more future atrocities such as the atomic bombings at the end of World War II, and the Cambodian genocide.
Mandus manages to reach the core of the machine, a massive pyramidal structure referred to as "The Temple" by the Engineer, and forces the Engineer back into his soul. Mandus sacrifices himself to the Machine, putting an end to both it and the Engineer, and ending the horrors above as year 1900 begins.