Trevor Reznik is a machinist whose insomnia has led to his becoming emaciated. His appearance and behavior keeps his coworkers away, and they eventually turn against him when he is involved in an accident that causes his coworker, Miller, to lose his left arm. Trevor, who was distracted by an unfamiliar co-worker named Ivan, is blamed for the accident. No one at the factory knows of Ivan and there are no records of him. Trevor seems to find peace only with Stevie, a prostitute with genuine affection for him, and with Marie, a waitress at an airport diner he frequents. He is haunted by brief flashes of recurring imagery, and things such as his car cigarette lighter take on a menacing air. A mysterious series of post-it notes appear on his refrigerator, depicting a game of hangman.
These vague incidents send him further into paranoia, but he nonetheless attempts to establish a relationship with Maria. Meeting her at an amusement park, Trevor goes with her son Nicholas on a fun house ride called "Route 666," whose flashing lights cause Nicholas to suffer an epileptic seizure. No longer able to think clearly, Trevor suspects that the bizarre events are a concerted effort to drive him insane. These ideas are fed to him in small random clues. One of them is a picture of Ivan fishing with Trevor's coworker Reynolds, which he discovers in Ivan's wallet when Ivan leaves it unattended in a pub. Another near-accident at work causes Trevor to lash out in rage at his co-workers; as a result, he is immediately fired. Increasingly distracted and alienated, Trevor forgets to pay his utility bills and his electricity is disconnected. A dark, viscous liquid begins trickling out of the freezer, coating the fridge door with streaks of what appears to be blood.
After several attempts to confront Ivan, Trevor tries to trace his license plate. He follows Ivan's car to read its license plate, but runs out of gas during the pursuit. When a DMV clerk insists that personal information cannot be released unless a crime has been committed, Trevor throws himself in front of a car in order to accuse Ivan of committing a hit and run. He files a police report with Ivan's plate number on it, only to be baffled when he is told that the car in question is his own; he had reported the vehicle totaled one year ago. He flees from the suspicious policemen and goes to Stevie, who clothes and washes him, but he finds the photo of Ivan and Reynolds framed in her home and accuses her of conspiring against him. Confused, Stevie says the picture is of Reynolds and Trevor, but he refuses to look at it and is thrown out after a verbal conflict. He goes to the airport diner, but is told by an unfamiliar waitress that they've never had an employee named Maria. The waitress has served Trevor every day for a year, Trevor saying so little the waitress began to think he was a mute.
In the film's climax, Trevor sees Ivan take Nicholas into Trevor's apartment and, fearing the worst, sneaks inside. Nicholas is nowhere to be seen and doesn't respond to Trevor's calls. He confronts Ivan in the bathroom and kills him after a struggle. He pulls back the shower curtain, only to find the bathtub empty. He goes to the refrigerator and opens it to find rotting fish and other spoiled food tumble out. His mind then flashes back to the fishing photo, which actually shows a healthy Trevor with Reynolds, just as Stevie claimed. Ivan being in the photo was part of Trevor's delusion. The scene returns to one that occurred during the opening credits, in which he tries to dispose of someone's corpse - presumably Ivan's - by rolling it in a rug and casting it into the ocean. When the rug unravels, there is nothing inside. Ivan, alive as ever, appears holding a flashlight and laughs.
The scene then cuts to Trevor staring into a mirror at home, repeating the words "I know who you are." It is revealed that one year ago, Trevor ran over and killed a boy identical to Nicholas after taking his eyes off the road to use the car's cigarette lighter, which was witnessed by the boy's mother, identical to Maria. He decided to drive away, and the resulting guilt became the deep-seated cause of his insomnia, emaciation and repressed memory. Ivan was a figment of Trevor's imagination and a manifestation of himself before the accident. He fills the missing letters of the hangman note to spell "killer." He briefly considers going to the airport and escaping, but instead drives to police headquarters, signifying his "road to salvation," a recurring theme in the film. He is accompanied by a silent but encouraging Ivan, who bids him an approving farewell outside the station. At the police station's front desk, he confesses to the hit and run. Two police officers escort Trevor to a cell, where he states his intention to sleep and does so for the first time in a year.
Despite its setting in a city in California, the film was shot in its entirety in and near Barcelona, Spain. It was produced by the Fantastic Factory label of Filmax and Castelao Productions.
Christian Bale dramatically dieted for over four months prior to filming, as his character needed to look drastically thin. According to a biography of Bale written by his former assistant, his daily diet at this time consisted of "water, an apple and one cup of coffee per day, with the occasional whiskey" (approximately 55–260 calories). According to the DVD commentary, he lost 62 pounds (28 kg), reducing his body mass to 120 pounds (54 kg). Bale wanted to go down to 99 pounds (45 kg), but the filmmakers would not let him due to health concerns. In fact, the weight that the 6 ft 0 inch (183 cm) Bale dropped down to was actually intended to be for a much shorter actor, but Bale insisted on seeing if he could make it anyway. At the end of filming he was left with just six months to regain the mass to be ready for his role in Batman Begins, which he achieved through weightlifting and binging on pizzas and ice cream.
Brad Anderson hurt his back during filming and directed much of the film while lying on a gurney.
The name Trevor Reznik is derived from Trent Reznor, the founder and primary creative force behind the industrial rock band Nine Inch Nails, and the original script had NIN lyrics on the first page. Other NIN tributes include the reversed N on the poster and early press articles describing Reznik as experiencing a downward spiral.
However, the strongest literary influence is the Russian novelist Fyodor Dostoyevsky. In the DVD commentary, writer Scott Kosar states that he was influenced by Dostoyevsky's The Double.The character Reznik is shown reading Dostoyevsky's The Idiot early in the film.
When Reznik is riding the "Route 666" attraction, one of the faux marquees reads Crime and Punishment.
In Dostoyevsky's The Brothers Karamazov, the character who is visited by a devil is named Ivan. In the 1969 film, Ivan and his devil are played by the same actor (Kirill Lavrov). At the end of the film, as Reznik is sitting in his cell, he's wearing a shirt reading 'Justice Brothers'.
The Machinist opened on 22 October 2004 in three theatres in North America and grossed $1,082,715 with an average of $21,553 per theatre ranking 45th at the box office. The film's widest release was 72 theatres and it grossed $1,082,715 in North America and $7,120,520 in other countries for a total of $8,203,235.
The Machinist received mainly positive reviews from critics. The film has a "certified fresh" score of 77% on Rotten Tomatoes based on 141 reviews with an average rating of 6.6 out of 10. The critical consensus states: "Brad Anderson's dark psychological thriller about a sleepless factory worker is elevated by Christian Bale's astonishingly committed performance." The film also has a score of 61 out of 100 on Metacritic based on 32 critics indicating "generally favorable reviews".
Roger Ebert gave the film three stars out of four and stated in his review for the film: "The director Brad Anderson, working from a screenplay by Scott Kosar, wants to convey a state of mind, and he and Bale do that with disturbing effectiveness. The photography by Xavi Gimenez and Charlie Jiminez is cold slates, blues and grays, the palate [sic] of despair. We see Trevor's world so clearly through his eyes that only gradually does it occur to us that every life is seen through a filter. We get up in the morning in possession of certain assumptions through which all of our experiences must filter. We cannot be rid of those assumptions, although an evolved person can at least try to take them into account. Most people never question their assumptions, and so reality exists for them as they think it does, whether it does or not. Some assumptions are necessary to make life bearable, such as the assumption that we will not die in the next 10 minutes. Others may lead us, as they lead Trevor, into a bleak solitude. Near the end of the movie, we understand him when he simply says, 'I just want to sleep.'"