In 1989, Anthony Swofford (Jake Gyllenhaal) is being trained in a U.S. Marine Corps boot camp, after which "Swoff" is dispatched to Camp Pendleton. In a flashback, he explains how going to college didn't work out, which is why he joined the military.
Swofford finds his training at Camp Pendleton tough as he struggles through making friends and living day to day, even pretending sickness, a trick Staff Sergeant Sykes (Jamie Foxx) does not fall for; Sykes is a Marine "lifer" who invites Swofford to his Scout Sniper course.
After training sessions that claim the life of one candidate, Swofford is one of the 8 remaining candidates who is trained as a sniper; his roommate Troy (Peter Sarsgaard) becomes his spotter. When Kuwait is invaded by Iraq, Swofford's unit is dispatched to the Persian Gulf as a part of Operation Desert Shield. Although eager to see combat, they spend their time waiting and training, with little more to do than ponder and discuss their typically unfaithful partners back home.
During an impromptu Christmas party instigated by Swofford, who has obtained unauthorized alcohol, Fergus (Brian Geraghty) accidentally sets fire to a tent and a crate of flares. Swofford gets the blame because he was supposed to be on watch but had Fergus sit in for him. Swofford is demoted from Lance Corporal (E-3) to Private (E-1) and is put on shit burning detail. The punishments, the heat and the boredom, combined with suspicions of his girlfriend's infidelity and feelings of isolation, temporarily drive Swofford to the point of mental breakdown - he threatens and nearly shoots fellow Marine Fergus, then turns the weapon on himself and orders the traumatized Fergus to shoot him. When Fergus refuses, Swofford leaves the tent.
After six months in the desert, Operation Desert Storm begins and the Marines are dispatched to the Saudi-Kuwaiti border. Just before, Swofford learns from Sykes that Troy concealed his criminal record when enlisting and will be discharged after the end of hostilities. Troy begins to keep distant from his fellow Marines. Knowing that Troy will never be allowed to re-enlist, the Marines attack him with a red-hot USMC branding iron, marking him as one of their own. Following an accidental air attack from friendly forces, the Marines advance through the desert, facing no enemies on the ground. The troops march through the Highway of Death, strewn with the burnt vehicles and charred bodies of retreating Iraqi soldiers, the aftermath of a U.S. bombing campaign. Later, the Marines suddenly catch sight of distant burning oil wells, ignited only moments before by the retreating Iraqis, and they attempt to dig sleeping holes as a rain of crude oil falls from the sky. Before they can finish, Sykes orders the squad to move upwind.
Swofford and Troy are finally given a combat mission. Their orders are to kill at least one of two high-ranking officers in Saddam's Republican Guard, holed up at a nearby airfield. At the last split second before Swofford takes the shot, Maj. Lincoln (Dennis Haysbert) interrupts them to call in an air strike. Swofford and Troy protest, but they are overruled and later look on in disappointment as the planes destroy the Iraqi airfield.
On returning home the troops parade through the towns in a jovial celebration of victory. Swofford returns home to his family and girlfriend but discovers her with a new boyfriend. Fowler is seen with a prostitute in a bar, Kruger (Lucas Black) in a corporate boardroom, Escobar (Laz Alonso) as a supermarket employee, Cortez (Jacob Vargas) as a father of three, and Sykes continuing his service as a First Sergeant in Operation Iraqi Freedom. An unspecified amount of time later, Swofford learns of Troy's death during a surprise visit from Fergus. He attends the funeral, reunites with some of his old friends and afterwards reminisces about the effects of the war.