Voyager encounters a strange energy field during a surprise party on the holodeck for Kes' second birthday. Many members of the crew are at the party, including Captain Janeway and The Doctor, who is acting as their bartender. The ship becomes surrounded by the energy field, and Tuvok, who is acting captain during the party, orders them closer. Eventually the ship becomes stuck in the field, causing the internal communications system on board Voyager to fail. The crew end the party early and attempt to return to their posts, however the ship's layout has mysteriously changed and they are unable to find their way. The various members of the crew eventually become separated and hopelessly lost within the labyrinthine corridors. Meanwhile, The Doctor becomes unable to return himself to sickbay, and finds himself amorously pursued by the hologram Sandrine.
During the exploration, Neelix once more becomes jealous of Paris's relationship with Kes; he then goes on to demand to know more about her friendships with other male officers. When she becomes angry and refuses to discuss her feelings with him, he goes to Chakotay for advice. Chakotay tells him that jealousy is natural, but that he must try to control himself for the sake of his relationship with Kes.
The crew, including Tuvok, who has left the bridge and become similarly lost, all find themselves back at the holodeck. They organize themselves in an attempt to reach crucial areas of the ship such as engineering and the bridge; B'Elanna and Paris are successful in reaching engineering, but when they try to transport to the bridge they find themselves back at the holodeck. Meanwhile, Janeway becomes delirious after coming into direct contact with the energy field, which is penetrating further into the ship, and is brought to the holodeck by Harry Kim in the hope that The Doctor can help her.
B'Elanna returns to Engineering and makes an attempt to stop the field with a ship-wide energy burst, but this only makes the field envelop the ship at an accelerated rate. With the holodeck as the last refuge, the crew gathers there, and Tuvok suggests that the most logical course of action is to simply do nothing, as any attempt to stop it has only made the situation worse, and they so far have no evidence that being engulfed by the field is fatal. They do as Tuvok suggests and neither the crew nor the ship is harmed by passing through the field, and Janeway is returned to health. Janeway surmises that the energy field was somehow sentient and trying to communicate with them – her theory is backed by the fact that the entire ship's memory had been downloaded and that 20 million gigaquads of data have been uploaded to Voyager's computer.
"Twisted" was extensively rewritten prior to being shot, and was for a time rumored to be so bad that it would never be aired, based largely on comments that Robert Picardo made at several fan conventions. The episode originally underran its time significantly, and several scenes had to be invented to extend its length, most significantly the subplot involving The Doctor being pursued by Sandrine. Script writer Michael Piller went on to voice criticisms about Neelix's subplot in this episode; he felt that the character should not be constantly portrayed as a 'buffoon', and attempting to correct the issues that he saw and resolve the subplot in question with the following episode, "Parturition".