The film begins in the summer of 1876, introducing Captain Nathan Algren (Tom Cruise), a disenchanted ex-United States Army captain and an alcoholic, who is traumatized by his experience fighting in the Civil War and the Indian Wars. In the years following his army service, Algren makes his living by relating war stories to gun show audiences in San Francisco, an experience which further hampers his mental state. Fed up with Algren's perpetual drunkenness, his employer fires him, forcing Algren to accept an invitation by his former commanding officer Colonel Bagley (Tony Goldwyn), whom Algren deeply hates and blames for his waking nightmares after his role in the massacring of Indians. Bagley approaches him with an offer on behalf of a Japanese businessman, Mr. Omura (Masato Harada), to help the new Meiji Restoration government train the new Western-style Imperial Japanese Army. Assisting them are Algren's old army colleague Sergeant Zebulon Gant (Billy Connolly) and Simon Graham (Timothy Spall), a British translator with a deep interest in the samurai.
Under the command of Bagley, Algren and his companions travel to Japan. Japan is in the middle of drastic civil change, and the new Western-style additions to society have not gone unopposed. The samurai are conducting an armed insurrection against the modernization campaign, and it is for the purpose of suppressing this insurrection that Algren is called to Japan. The newly-formed Japanese Army is a poorly-trained and equipped conscripted army of peasants totally lacking in combat experience. Algren does his best to remedy this, but before the men are trained to his satisfaction, the leader of the insurrection, Katsumoto (Ken Watanabe), attacks a railroad outside his province. Bagley orders Algren to lead the inexperienced conscripts to engage Katsumoto. Algren protests and, in a demonstration, illustrates the army's inexperience and inadequate training. Bagley dismisses Algren's concerns and orders a regiment to track down and engage Katsumoto.
When the regiment arrives at the battlefield, Bagley moves to the rear and orders Algren to do the same, since the Americans are technically non-combatants. Algren refuses and takes personal command of the regiment. Algren then orders Sergeant Gant to report to the rear as well, but Gant refuses out of personal loyalty to Algren. During the battle, the conscripted peasants panic despite Algren's best efforts to keep them under control.
Samurai swarm the wholly unprepared army and the soldiers flee in disarray. Algren and Gant stand their ground and manage to kill several samurai, but Gant is killed and Algren is thrown from his horse. On foot, he desperately fends off several samurai with a broken spear embroidered with a flag depicting a white tiger. The flag on the spear reminds Katsumoto of a vision he experienced during meditation. Katsumoto's brother-in-law, the red-masked samurai Hirotaro and Gant's killer, prepares to finish Algren as well, but Algren seizes a spear from the ground and stabs him through the throat. Believing what he has witnessed to be an omen, Katsumoto prevents his warriors finishing off the wounded Algren and takes him prisoner. Algren is taken to an isolated village, where he gradually recovers in a house belonging to Hirotaro's family, including his widow Taka, her two sons, Higen and Magojiro, and Katsumoto's son, Nobutada (Shin Koyamada).
Over time, Algren overcomes both his alcoholism and the nightmares of his traumatic past, and begins to assimilate to village life, although he does not adopt many Japanese customs. Eventually, he meets Katsumoto, who takes an interest in Algren and begins conversing regularly with him, each gaining a healthy respect for the other. Algren confides to his journal that he has never felt entirely at peace until he came among Katsumoto and his people. Despite lingering fidelity to Hirotaro, Taka develops romantic feelings for Algren, particularly when she notices his budding fatherly relationship toward her children. Algren studies swordsmanship under skilled swordmaster Ujio (Hiroyuki Sanada) and becomes fluent in Japanese by conversing with the local residents, earning their respect.
One night, Katsumoto parodies the comic role of a kygen actor in an open-air torchlight performance (Takigi Noh). The carefree respite is interrupted by an attack of ninja assassins. Algren raises the alarm and then takes up a sword to help the defense. The samurai succeed in defeating the ninjas, but with many losses. Though Katsumoto does not confirm it, Algren deduces that the attack was ordered by Omura.
In spring, Algren is taken back to Tokyo. There he learns that the army, under Bagley's command, is now better organized and outfitted with howitzers and Gatling guns from the United States. Omura offers to place Algren in command of the army if he agrees to crush the samurai rebellion, but Algren declines. In private, Omura orders his men to kill Algren if he attempts to warn Katsumoto of their intentions. At the same time, Katsumoto offers his counsel to the young Emperor, to whom he was once a teacher. He learns that the Emperor's hold upon the throne is much weaker than he thought, and that he is essentially a puppet of Omura. When Katsumoto refuses to observe new laws that forbid samurai to publicly carry swords, he is arrested and confined to his quarters in Tokyo. Anticipating an assassination attempt on Katsumoto, Algren heads directly for his quarters but is ambushed by Omura's men; Algren narrowly escapes death through use of the skills he learned in Katsumoto's camp. With the assistance of Ujio, Nobutada, Nakao, the Silent Samurai, and Graham, Algren frees Katsumoto from custody. During their flight, Nobutada is mortally wounded and stays behind to aid his father's escape; Algren looks on as a mortally wounded Nobutada charges their foes, only to be cut down by gun fire.
Katsumoto is still mourning the loss of his son when he receives word that a large Imperial Army unit, commanded by Omura and Bagley, is marching out to engage the samurai. A counter-force of samurai, numbering only 500, is rallied. Algren makes a reference to the Battle of Thermopylae in which a small army of 300 Greeks fought against a much larger opposing force of 1 million Persians by using the terrain and the enemy's overconfidence to their advantage; Algren surmises that a similar tactic would reduce the effectiveness of their enemy's artillery. On the eve of battle, Algren is presented with a katana of his own. Taka also gives him her dead husband's armor, and they kiss just before Algren leaves.
When the Imperial Army confronts the samurai's rebel forces, the samurai fall back to higher ground, preventing the Imperial soldiers from using their superior firepower. As expected, Omura immediately orders the infantry to advance. Bagley expresses misgivings and advises sending in scouting groups first to assess the area, but Omura overrules him and insists on a full attack, and thus the infantry marches straight into a trap. Setting blocking fires to cut the enemy's immediate fighting strength in half, the samurai then unleash volleys of arrows on the infantrymen. A wave of samurai swordsmen, Katsumoto and Algren among them, attack the disorganized body of soldiers before they can recover from the arrow attack. A second wave of Imperial infantry follows behind, only to be countered by samurai cavalry, and a savage mêlée ensues that leaves many dead on both sides before the Imperial soldiers finally retreat.
Realizing that fresh Imperial forces are coming and that defeat is inevitable should a second battle occur, the surviving samurai resolve to make a final, fate-charged mounted assault. During the battle, Bagley shoots Katsumoto in the shoulder, but before he can finish off the samurai, Algren hurls his sword at Bagley, killing him by spearing him through the chest. On approaching the Imperial rear line and progressing far enough to scare Omura, the samurai are finally cut down by Gatling gun fire. Moved by the sight of the dying samurai, who charged fearlessly despite the Imperial soldiers' superior firepower, the captain of the Imperial troops (who was originally trained by Algren) orders the Gatling guns to cease fire, against Omura's wishes. Katsumoto, observing Bushido, asks Algren to assist him in performing seppuku; Algren obeys, ending Katsumoto's life. Led by their captain, the Imperial soldiers show their still-lingering respect for the old order by kneeling and bowing before the fallen samurai.
Later, as the American ambassador prepares to have the Emperor sign a treaty that would give the U.S. exclusive rights to sell firearms to the Japanese government, a badly injured Algren offers Katsumoto's sword as a gift to the Emperor. The Emperor understands the message and realizes that, while Japan must modernize, it also must never forget its own history, cultural identity, and traditions. The Emperor then tells the American ambassador that his treaty is not in the best interests of Japan. When Omura objects, the Emperor, realizing that he need not be ruled by Omura, confiscates his estates and fortunes. When Omura tries to protest, the Emperor then offers him Katsumoto's sword, retorting that if the dishonor is too great to bear, he should commit seppuku. The cowardly but respectful Omura merely lowers his head and walks away.
The film ends with Algren under a narrative provided by Simon Graham returning to the samurai village and to Taka. Graham philosophically concludes that Algren has "found some small measure of peace that we all seek, and few of us ever find".