In the near future, weapons master James McCullen (Christopher Eccleston) has created a nanotech-based weapon - nanomites designed to devour metal and other materials, capable of destroying anything from tanks to cities. The nanobots can only be stopped by activating the kill switch. His company M.A.R.S. sells four warheads to NATO, and NATO troops led by American soldiers Duke (Channing Tatum) and Ripcord (Marlon Wayans) are asked to deliver the warheads. Their convoy is ambushed by the Baroness (Sienna Miller), whom Duke recognizes to be his ex-fiancee Ana Lewis. Duke and Ripcord are rescued by Scarlett (Rachel Nichols), Snake Eyes (Ray Park), Breaker (Sa誰d Taghmaoui), and Heavy Duty (Adewale Akinnuoye-Agbaje). They take the warheads to The Pit, G.I. Joe's command center in Egypt, and upon arriving, rendezvous with the head of the G.I. Joe Team, General Hawk (Dennis Quaid). Hawk takes command of the warheads and excuses Duke and Ripcord, only to be convinced to let them join his group, after Duke reveals that he knows the Baroness.
McCullen is revealed to be using the same nanotechnology to build an army of soldiers with the aid of the Doctor (Joseph Gordon-Levitt), planning on using the warheads to cause worldwide panic and bring about a new world order. Using a tracking device, McCullen locates the G.I. Joe base and sends Storm Shadow (Byung-Hun Lee) and the Baroness to retrieve the warheads, with assistance from Zartan (Arnold Vosloo).
After a fight, Storm Shadow and the Baroness retrieve the warheads and take them to Baron DeCobray, the Baroness's husband, for him to weaponize. Making their way to Paris, the Joes pursue the Baroness and Storm Shadow, but are unsuccessful in stopping them from launching one of the missiles. The missile hits the Eiffel Tower and releases the nanomites in it, destroying the tower and some of the surrounding area before Duke manages to hit the kill switch, but in so doing, he is captured and taken to McCullen's base under the Arctic.
The Joes locate the secret base and fly there, as McCullen loads three missiles with nanowarheads, which are aimed for Beijing, Moscow, and Washington, DC, the world's three most important cities. He intends to do this to strike fear into the hearts of every man, woman, and child on the planet, after which they will turn to the person with the most power in the world, the President of the United States. After Snake Eyes takes out one missile, Ripcord destroys the remaining two using a stolen M.A.R.S. prototype Night Raven jet, while Scarlett, Breaker, and Snake Eyes infiltrate the base. Snake Eyes duels and prevails over Storm Shadow. Duke learns that the Doctor is Rex Lewis, Ana's brother, believed to have been killed by a mistimed airstrike during a mission led by Duke (also the origin of the alienation between Duke and Ana). Rex had encountered Doctor Mindbender (Kevin J. O'Connor) in the bunker and was seduced by the nanomite technology, taking too long to retrieve the data and getting caught in the bombing, which disfigured him. After freeing Duke, the Baroness is subdued, as the Doctor reveals he has implanted her with nanomites, which has put her under his control for the past four years. Attempting to kill Duke, McCullen ends up being burned, so the Doctor and he flee to an escape vessel. Duke and the Baroness pursue him while the Joes fall back; when the Doctor activates the base's self-destruct sequence, which involves 'blowing the ice cap' to create blocks of ice which then nearly crush the Joes.
The Doctor assumes the identity of the Commander, having healed McCullen's burned face with nanomites, encasing it in silver and naming him "Destro", which places McCullen under the Commander's control. They are captured by G.I. Joe soon after. On the supercarrier USS Flagg, the Baroness is placed in protective custody until they can remove the nanomites from her body. Meanwhile, Zartan, having had his physical appearance altered by nanomites, infiltrates the White House during the missile crisis and assumes the identity of the President of the United States of America (Jonathan Pryce), thus completing a part of McCullen's plan to rule the world.

Question: What is the one way to stop the nanobots?
Answer: By activating the kill switch