In the summer of 1982, a young Sam Brenner rides his bicycle to the home of his best friend Will Cooper to tell him the new arcade in town is open. They spend the whole day there, with Brenner dominating almost every game while Cooper excels at the crane machine and wins a Chewbacca mask. Seeing how awesome Brenner is at games, Cooper grabs a flyer for the arcade game world championships and says Brenner should bring his skills here.
At the event, the MC (Dan Aykroyd) tells everyone that a time capsule will be launched into space containing elements of the present culture. Brenner and Cooper meet Ludlow Lamonsoff, a weird but brilliant kid who's in love with Lady Lisa, the main character of the game Dojo Quest. After Brenner gets through every game, he faces hotshot gamer Eddie Plant in Donkey Kong. Eddie mentions the pattern to the game, causing Brenner to lose focus and come in second place.
In the present day, the adult Brenner (Adam Sandler) works for a company that installs software. Cooper (Kevin James) is the President of the United States, and he is frequently mocked in the media, most recently for failing to read properly during a kindergarten class and yelling at a little girl.
In Guam, a military base picks up a threatening signal. Alien life forms based off the designs of Galaga attack. The soldiers try to fight back but are easily taken out. One soldier (Affion Crockett) gets taken by the aliens.
Brenner goes to a home to do his job. He meets a lady named Violet Van Patten (Michelle Monaghan) and her son Matty (Matt Lintz), who tells Brenner that his mom is going through a divorce. While Brenner goes to work, he hears Violet crying in the closet. He comforts her by listening to her situation, and they share wine. He thinks they're having a moment, and he goes in for a kiss but gets shut down. He then gets a call from Cooper telling him to be at the White House soon.
Brenner heads to the White House with Violet close by. To his surprise, he finds out she is a Lieutenant Colonel. Cooper brings Brenner into the Oval Office to show him the Galaga aliens attacking.
Later, Brenner drives his van home to find Ludlow (Josh Gad) in there. Ludlow brings Brenner back to his home where he says that the aliens are sending creatures with classic video game designs to attack. Ludlow received a message using manipulated footage of 1980's icons like Ronald Reagan and Madonna to explain their plans: since they perceived the items in the time capsule as a declaration of war, they are using the video games as a challenge, giving the people of Earth three rounds to fight back or it's game over for everyone. They also show that the soldier they took was a "trophy". They show the video to Cooper and determine that the next attack will happen in India. Sure enough, the aliens attack the Taj Mahal, and they take an Indian man as a trophy as well.
Brenner and Ludlow are brought in to "train" soldiers to fight back by showing them how to play these games, to which Admiral Porter (Brian Cox) objects. Violet shows Brenner and Ludlow that the pixels are taken down by strong light beams. Cooper is with his wife Jane (Jane Krakowski) at a bakery when his assistant comes in to tell him that the next attack will happen in London.
Everyone heads to London to meet with Corporal Hill (Sean Bean). The soldiers brace for attack as the creatures from Centipede attack. Brenner tells the men to shoot for the head and anticipate the pattern, but they have no luck. Brenner and Ludlow take over with permission from Cooper, and they blast away at the Centipede. The final boss makes its way into town and nearly devours a boy until Brenner blasts it away for good.
The aliens send a message using the Fantasy Island guys to congratulate Earth on their victory, and they give them the Duck Hunt dog as a trophy, but remind them that they (aliens) are leading 2-1. It is learned that the next attack will happen in New York City. Needing more help, Ludlow and Cooper agree that they need someone else to help them.
Brenner, Cooper, and Violet go to a prison to find Eddie (Peter Dinklage), a bitter and hardened criminal who got busted for adding charges to phone bills. He still taunts Brenner and makes self-serving demands in exchange for his help, among them a private island for himself, never paying taxes again, and a meeting with Serena Williams and Martha Stewart. Cooper agrees to let him out of prison... but only with the 'no taxes' agreement.
The team goes to New York to discover that the next boss is Pac-Man. Violet presents the guys with four cars based off the ghosts in Pac-Man, with the fourth car driven by the game's creator Toru Iwatani (Denis Akiyama). When the team gets downtown Manhattan where Pac-Man is chomping through everything, Iwatani tries to appeal to Pac-Man's good side by talking to him like a father. Unfortunately, this gets his hand chomped and pixelated. The remaining three chase after Pac-Man. He eats a power pellet, giving him ten seconds to be able to eat the ghosts, and he eats Ludlow's car as he jumps out.. Eddie hits the first Pac-Man after catching up to him quickly. The second one also gets taken out by Eddie. The third causes him to drive into the water. Brenner chases him near a parking garage where Pac-Man finds another power pellet. Brenner counts down and drives backward through a parking garage. At the last second, the power pellet wears off and gives Brenner a chance to defeat Pac-Man, and they're given Q*Bert as a trophy.
The team has a ball held for them as thanks for their heroics. Brenner asks Violet to be his date, and she stuns him when she arrives in a green dress. Eddie brings Serena Williams (who only showed up because she was promised an island). After Brenner spends time with Violet, the aliens send another message saying the rules have been violated, and they will launch a full-scale attack momentarily. Marty finds Eddie and sees that his shades that were fished out of the water contain cheat codes, which allowed him to beat Pac-Man and also explains how he beat Brenner in Donkey Kong. Eddie flees, and Matty is taken by the aliens as Violet watches.
Q*Bert tells the heroes that the aliens were peaceful until they felt threatened by the time capsule. They realize they have to go to the ship and stop the aliens.
The aliens bring down more video games upon Washington DC, including Frogger and Defendor. Brenner, Violet, and Q*Bert gear up and are joined by Cooper while Ludlow stays behind to fight. One of the aliens takes the form of Lady Lisa (Ashley Benson), to Ludlow's joy. However, she still fights him until he says he only wants to love her. She drops her swords, and they kiss. Eddie comes to fight and apologizes for ditching the team.
Brenner, Violet, Cooper and Q*Bert get brought up to the ship where Brenner faces his biggest challenge... Donkey Kong. The ape rolls barrels down as the heroes try to reach Matty and the other two captives. Matty tells Brenner that Eddie cheated all those years ago, making him realize he is the true DK champ. Brenner takes the hammer and smashes the barrels before hurling it at Donkey Kong, destroying him. This causes the rest of the video games to freeze and be brought back up to the ship. Unfortunately for Ludlow, that includes Lady Lisa.
The team is recognized as heroes before the White House. Cooper announces he's made a peace treaty with the aliens. Eddie apologizes to Brenner for cheating and admits he's the best in the world. Ludlow misses Lisa until Q*Bert randomly morphs into her. Brenner and Violet become a couple. Eddie then gets a text from Serena to meet him in the bedroom, along with Martha Stewart, who made sandwiches. Eddie sneaks off with excitement. The aliens leave Earth, and Iwatani's hand is restored.
One year later, Ludlow has married Lisa, and they're the proud parents of five Q*Berts.