This offbeat, fantasy drama delves into the adventures of Craig Schwartz (John Cusack), an unsuccessful, unemployed puppeteer and in a forlorn marriage with his pet-obsessed wife Lotte (Cameron Diaz). He gains employment through Dr. Lester (Orson Bean) at LesterCorp as a filer, run out of the strange low-ceiling offices on floor 7½ of the Mertin Flemmer building in New York City.
While settling in he develops a strong love for his co-worker Maxine (Catherine Keener) who does not return these affections. Schwartz, while filing paperwork, discovers a portal behind a filing cabinet, and when he enters it, finds himself in the mind of actor John Horatio Malkovich (John Gavin Malkovich), able to observe and sense whatever Malkovich does for fifteen minutes before he is ejected and dropped into a ditch adjacent to the New Jersey Turnpike. When he reveals the portal to Maxine, they decide to start a business to allow others to experience Malkovich at $200 a head.
When Schwartz explains his new business venture to Lotte, she decides that she must try the portal. Lotte becomes obsessed with the experience, which allows her to live out her transgender desires. While having dinner at Dr. Lester's residence with Schwartz, Lotte finds a room dedicated to Malkovich. One time while Lotte is inside Malkovich, he goes on a date with Maxine. Maxine falls in love with Malkovich (with Lotte inside him), and they continue to see each other in this fashion, including making love to each other. Schwartz, realizing that he has been forsaken by both women, ties and locks up his wife, while he enters into Malkovich's mind and dates Maxine.
Schwartz, drawing on his background as a puppeteer, discovers that he is able to control Malkovich's actions while in his head, and this causes the actor to become paranoid. After consulting with his friend Charlie Sheen, Malkovich trails Maxine to the Mertin Flemmer building, where he finds out about, and insists upon trying, the portal. He finds himself in a world where everyone looks like him and can only say "Malkovich"; he is quickly ejected and meets Schwartz by the turnpike. Malkovich angrily demands that Schwartz close the portal, but he refuses.
As Schwartz enters Malkovich to prepare for the next date with Maxine, Lotte escapes her bonds and phones Maxine, revealing that it wasn't her making love inside John's body but Schwartz; Maxine however has enjoyed her experience and continues her relationship with Schwartz inside Malkovitch. Lotte seeks out Dr. Lester for help. From him, Lotte learns that Dr. Lester is well aware of the portal and has been using it to live on for years after years, changing from one dying body to a younger one each time. When the body is "ripe", the portal moves to its next host. Anyone who manages to enter the portal at the right time when the body becomes "ripe" gets to live on in the body. At the present time, the portal is connected to the body of Malkovich, which is getting "ripe" soon. Dr. Lester reveals to Lotte his plan to use Malkovich as a host for himself and several of his friends. Lotte warns him that Schwartz has become able to control Malkovich and it may be difficult to displace him.
While out on a date with Maxine, Schwartz decides to remain in Malkovich indefinitely. He spends the next eight months in Malkovich's body and through his control of the body, turns Malkovich into a world-famous puppeteer, revitalizing the art of puppetry. Malkovich also gets married to Maxine during this period of time. Eventually, their relationship becomes more distant. Maxine learns that she is pregnant. As the time when Malkovich's body turns ripe and the portal finds its next host draws near, Dr. Lester and his friends capture Maxine and demand of Schwartz that he leave Malkovich's body, threatening to kill Maxine if he doesn't cooperate. Schwartz refuses. Lotte, believing Maxine to be the source of her problems, seeks her out at the Mertin Flemmer building; the two fall together into the portal, travel through Malkovich's childhood memories, and end up being ejected next to the turnpike. Maxine then reveals to Lotte that she conceived when Lotte was inside Malkovich's body. The two fall in love with each other.
After a bar fight, Schwartz decides to leave Malkovich's body voluntarily. Malkovich finds he briefly has control of himself before Dr. Lester and his friends enter the portal, just before the portal moves on to the next host. After Schwartz discovers that Lotte and Maxine have fallen for each other, he uses the portal again but finds himself in the next host which happens to be Emily, the baby of Maxine. Schwartz ends up being forced to watch Maxine and Lotte live happily ever after through the eyes of the child. Later, an aging Malkovich, under the collective mind of Dr. Lester and his friends, reveals to a now aged Sheen a plan to prolong their lives through Emily.