Craig Schwartz (Cusack) is an unemployed puppeteer in a forlorn marriage with his pet-obsessed wife Lotte (Diaz). Gaining a file clerk job through Dr. Lester (Bean) at LesterCorp, in the strange Floor 7  low-ceiling offices of the Mertin-Flemmer Building in New York City, he develops an attraction to his coworker Maxine Lund (Keener), who does not return his affections. Craig enters a small door hidden behind a filing cabinet and finds himself in the mind of actor John Malkovich. Craig is able to observe and sense whatever Malkovich does for fifteen minutes before he is ejected and dropped into a ditch near the New Jersey Turnpike. He reveals the portal to Maxine and they let others use it for $200 a turn.
Craig tells Lotte, who becomes obsessed with the experience, allowing her to live out her transgender desires. Lotte becomes attracted to Maxine and they begin a sexual relationship via Lotte being inside Malkovich's head while Maxine has sex with Malkovich. Craig, forsaken by both women, binds and gags Lotte and locks her in a cage, then enters Malkovich's mind and has sex with Maxine. Craig discovers that he is able to control Malkovich's actions while in his head, causing the actor to become paranoid. After consulting with his friend Charlie Sheen, Malkovich trails Maxine to the Mertin-Flemmer building, where he tries the portal and is placed in a world where everyone looks like him and can only say "Malkovich". He is ejected and meets Craig by the turnpike. Malkovich demands that the portal be closed, but Craig refuses.
Lotte escapes with the help of the animals in the cage and phones Maxine, revealing that Craig was having sex with her. Maxine is annoyed but accepts it as she enjoyed the experience. Seeking help, Lotte finds Lester, who reveals himself to be Captain Mertin, the creator of LesterCorp. He is aware of the portal and has a room dedicated to Malkovich. Lester explains that the person connected to it becomes "ripe" for occupation on the eve of their 44th birthday. However, after the old host turns 44, the portal moves to its next host, an unborn child. The former allows one to increase their life before moving on to another host while the latter means being trapped within the unborn child. Lester, who has been using the portal to prolong his life, reveals his plan to use Malkovich for himself and several of his friends. Offered the chance to join Lester's group, Lotte warns him that Craig has control.
Craig finds he is able to remain in Malkovich indefinitely. He spends the next eight months in Malkovich's body, and through his control turns Malkovich into a world-famous puppeteer. Malkovich marries Maxine and learns that she is pregnant as their relationship grows distant. As Malkovich's 44th birthday approaches, Lester and his friends cut a deal with Maxine and fake her kidnapping. They call up Craig threatening to kill her if Craig does not leave Malkovich. Craig ends the call, causing Lester to think that he called their bluff. Lotte loses hope and attempts to kill Maxine, but they end up at the turnpike after falling through the portal and Malkovich's shame-ridden subconscious. Maxine reveals that she conceived when Lotte was inside Malkovich's body and kept the child because it is theirs. The revelation cements their love for each other.
Craig calls back Lester thinking Maxine is still in danger. Realizing his opportunity, Lester continues his bluff, convincing Craig to leave Malkovich's body. Lester and his friends enter the portal, taking control of Malkovich. Craig, discovering that Lotte and Maxine are together again, decides to enter the portal to become Malkovich and regain Maxine. Years later, an aging Malkovich, under the collective mind of Lester and his friends, reveals to Sheen a plan to prolong their lives through Emily, Maxine's daughter, who it is revealed Craig is now permanently trapped within after entering the portal, supposedly powerless as he watches Maxine and Lotte living happily through Emily's eyes.
Output: What happens to John Malkovich when Craig discovers he can control Makhovich's actions while inside his head?