Bane/Smith and Neo are both in an unconscious state. The former is said to be merely asleep, whereas neural patterns of Neo are identical to those of people who are connected to the Matrix. Morpheus, dispirited after the destruction of the Nebuchadnezzar and discovering the true nature of the Prophecy at the end of the last film, starts a search for Neo within the Matrix despite him not being jacked in. Neo is in fact trapped in a limbo: a subway station named "Mobil Avenue", a transition zone between the Matrix and the Source.
At this station, Neo meets a 'family' of programs (of Indian Origin). The little girl called Sati talks to Neo. Father tells Neo that Mobil Avenue is controlled by a program called The Trainman who, in turn, is an exile loyal only to The Merovingian. When Neo tries to board the train with the family, the Trainman refuses, and knocks him away from the train, telling Neo he makes the rules down here.
Seraph contacts Morpheus on behalf of the Oracle, who now resides in a different "shell". The Oracle informs Morpheus and Trinity of Neo being trapped in Mobil Avenue. Seraph, Morpheus, and Trinity pursue the Trainman to secure Neo's release, but he escapes. Their only option now is to go to Club Hel and confront the Merovingian for Neo's freedom. The three fight their way from the club's parking garage to the coat check station. They engage some of the Merovingian's guards, who are able to walk on ceilings and walls.
The trio force their way into a large dance hall, brandishing two guns each. The Merovingian, in a display of scornful admiration, tells them to hand over their guns and he'll meet with them directly. The Merovingian demands "the eyes of the Oracle" in exchange for Neo's release. Trinity however loses her patience and provokes a Mexican standoff in which she, Morpheus, Seraph and the Merovingian each have a gun to their heads, forcing the Merovingian to release Neo.
In Mobil Ave, Neo tries to leave by running through the train tunnel. When he does, he simply runs back into the station from the opposite direction. Some time later, Trinity arrives and frees Neo. Troubled by new visions of the Machine City, Neo decides to visit the Oracle one last time before returning to the real world. She informs him that as the One, upon visiting the Source, he developed a connection with it.
The Matrix and the rest of the Machine world, are derived from the Source as well. Thus we learn that all of Neo's abilities - both in and out of the Matrix - exist because of this connection. This is how Neo was able to stop the machines giving pursuit after the Nebuchadnezzar was destroyed, although the end result of his lack of preparation was temporary confinement in Mobil Avenue. She characterizes Smith as his exact "opposite" and his "negative".
She also elaborates upon the relationship between her and the Architect (tellingly, each of them ejects an exasperated "Please!" when Neo asks them about the other). She also tells Neo cryptically that "everything that has a beginning has an end" and warns that Smith's power threatens not only the Matrix, but also the Source and eventually the Machine City. The Oracle states that the war is about to end "one way or another."
After Neo takes leave of the Oracle, a large group of Smith clones arrive at her home. They successfully assimilate the unresisting Oracle, and having gained her powers of precognition, the new Smith cackles maniacally at the future he is seeing.
In the real world, the remaining crew of the Nebuchadnezzar and the Mjolnir (referred to by the characters as "the Hammer") encounter Niobe's deactivated ship, the Logos and its crew. They successfully reactivate the ship and begin to interrogate the now awakened Bane, who claims he has no memory of the events of the earlier battle.
After contemplating his visions, Neo announces that he needs a ship to travel to the Machine City, although he cannot explain why. Roland, the Mjolnir's captain refuses him but Niobe (who was told by the Oracle in Enter The Matrix that she would have to make a choice to help Neo or not), lets him take the Logos. Trinity decides to accompany Neo.
The two remaining crews plan to return to Zion, and avoid the Sentinel army by allowing Niobe to pilot the Mjolnir through a series of service tunnels, which are nearly impossible to navigate. Shortly after departure, the Mjolnir's crew discover that Bane has murdered a crew member and has hidden aboard the Logos. However they are unable to double-back in order to warn Trinity and Neo.
Before the Logos can depart, Bane ambushes Trinity and takes her hostage. Neo fights Bane, who reveals himself as a manifestation of Smith. During the struggle, Bane manages to blind Neo by cauterizing his eyes with a severed electric cable.
As Bane appears to have the upper hand, he closes in on Neo - only to have his attack thwarted and reversed. Neo can see Smith inside Bane as a fiery form, in spite of his blindness. Neo finishes the fight by smashing Bane's head with a jackhandle and releases Trinity, who pilots them towards the Machine City.
Niobe, with Morpheus as her co-pilot, flies the Mjolnir through the lowest tunnel system. Flying slowly and at low power to avoid detection, they make their way to Zion. One of the craft's hover pads collides with the debris on the floor of the tunnel - the bang is heard by the sentinels, who immediately pursue the craft.
The crew makes a valiant effort to fight them off, however, they overwhelm the ship and begin to damage it with cutting lasers. A small group of sentinels also rips off the craft's communication's antenna, making it impossible for them to tell Zion they're coming.
In Zion, the defenders deploy infantry armed with rocket launchers and Armored Personnel Units in order to protect the dock from assault. The dock is breached by two giant drilling machines, Diggers, and a huge swarm of sentinels, igniting The Battle of Zion. Despite a desperate effort the APUs fail in holding the Dock and many are destroyed.
In other areas of the dock, Link's wife, Zee, and her partner, Charra, use a rocket launcher to fight the sentinels and Diggers. Charra manages to blow the leg off a Digger, however it uses another of it's legs to stabilize itself. She is also able to disable another Digger for a short time - it is soon reactivated by more sentinels that recharge the massive machine. Zee is able to escape the sentinels, however, Charra is killed by them.
During the battle, Captain Mifune fails to open the gate for the approaching Mjolnir and is attacked and viciously wounded by a swarm of sentinels. With his last breath he tells Kid (who was renewing his ammunition supply at the time), to open the gate for the Mjolnir. Kid is reluctant at first, saying he did not complete the combat training needed, only for Mifune to tell him, "Neither did I." This gives Kid the courage to fight through a cloud of Sentinels to the gate and open it.
Just as the remaining humans are about to be overwhelmed, the Mjolnir bursts through the gate, with further Sentinels shortly behind, setting off an EMP which disables all electronic equipment in the area. The EMP destroys all the present Sentinels, but it also disables the remainder of Zion's defenses. The humans are forced gather what weapons they can and fall back to the temple entrance, awaiting the next swarm which will surely overwhelm them all.
Nearing the Machine City, Neo and Trinity fly over the harvesting fields where millions of humans produce energy for the city. They are attacked by the city's defense system, which hurls numerous mobile bombs and Sentinels at the Logos. Neo uses the power given by his connection to the Source to destroy the incoming bombs. However, Sentinels overwhelm the ship. To evade them Trinity flies the Logos up into an electrical storm cloud.
The Sentinels are disabled, but the cloud also disables the ship's engines. As the ship emerges temporarily above the cloud layer, Trinity gets a glimpse of real sunlight and blue sky. The ship then stalls and plummets back into the storm cloud as it free-falls directly toward the Machine City. Trinity attempts to ignite the engines but it is too late and the ship crashes into a machine tower. The impact of the collision fatally wounds Trinity, and she dies in Neo's arms.
Neo emerges into the Machine City to strike a bargain with the machines, personified by the Deus Ex Machina. Neo warns the machines that Smith (who has by now assimilated every human and programme within the Matrix) is beyond the machines' control, and will soon assault the Source to which the Matrix is connected. He offers to help stop Smith in exchange for a ceasefire on Zion.
The second wave of Sentinels in Zion instantly responds by standing down at the temple entrance. Neo openly confronts the Deus Ex Machina, a massive droid with a human child's face that acts as the interface to The Source. Neo negotiates with it, saying that in exchange for a peaceful coexistence, he'll destroy Smith and his clones, which have infected most of the Machine City.
The Deus insists that they don't need Neo's assistance, to which Neo says "If that's true... then you should kill me now." The Deus agrees, providing a connection for Neo to enter the Matrix and confront Smith. The Deus suggests that Neo might fail - Neo says he won't.
The city is now wholly populated by tens of thousands of Smith copies - the clone with the Oracle's powers steps forth, claiming he has already foreseen his own victory. Smith's clones stand by and watch while Neo and Smith square off. Fighting on the streets, through buildings and into the sky, they continually repel each other. While battling in the sky, Smith grabs Neo and plunges to the ground with him, creating a massive crater.
The two continue to battle in the crater, seemingly to a standstill. Neo is eventually outmatched by Smith, who pauses to gloat that he has "seen this [the details of his victory] before". Describing the details aloud, he cannot remember what he was supposed to say next in his vision. Neo refuses to give up the fight, and a frustrated Smith continues his attack until Neo is too badly hurt to go on.
To both Smith and Neo's surprise, Smith announces "everything that has a beginning has an end." Hearing the Oracle's parting advice again allows Neo to understand that Smith's assimilation is not total, and baits the scared Smith into assimilating him. Neo's final words to Smith are, "It was inevitable," quoting Smith's oft-spoken admonition.
Smith's assimilation of Neo is seemingly successful, and when the Oracle-Smith asks Neo-Smith whether it is over, he receives a nod and smile as reply. Back in the Machine city, Neo's body spasms as a surge of energy enters his body through the Matrix connection. Neo is returning to the source, and starting with the Neo copy of Smith, a white light begins to rip the clones apart from the inside out. One by one, similar to the destruction of Agent Smith at the end of The Matrix, the copies are destroyed.
With the elimination of the Smiths, all the programs and humans that were possessed return to normal, including the Oracle. The Sentinels that were about to attack the humans withdraw from Zion. Neo, having sacrificed himself to save both the Machines and humans, is unplugged from the Matrix and his body is respectfully carried away by the Machines.
The Architect, upon meeting the Oracle, tells her that she "played a very dangerous game" by attempting to change the way the Matrix functioned. The Oracle responds by saying that she understood the risk and knew it was worth taking. She asks the Architect what will become of any humans who want to be unplugged from the Matrix, and the Architect replies that "they will be freed." The Oracle asks the Architect, "Do I have your word?" The Architect answers "What do you think I am? Human?"
The closing shot of the film depicts a new dawn on the world of the Matrix, created by Sati. Plant life is shown in the Matrix, and for the first (and last) time the ubiquitous green tint is absent.