P.K. Highsmith and Christopher Danson (Samuel L. Jackson and the Rock) begin the movie with a crazy high speed chase through the city, which seemingly ends with them crashing their car into the middle of a double decker tour bus. They continue to pursue the drug dealers with the bus ultimately crashing into the Trump Tower. As they’re holding a press conference, they minimalize the fact that they cause $12 million worth of damage over a few grams of marijuana or cocaine. They arrive at the police station to a standing ovation from their fellow officers, all except for Terry Hoitz (Mark Wahlberg) who’s sulking. When the captain asks who’ll write up the report (since Danson and Highsmith never do), Hoitz’s partner Allen Gamble (Will Ferrell) volunteers.

Hoitz and Gamble do not get along. Gamble enjoys the safety and comfort of mundane tasks, while Hoitz believes he’s being suffocated saying they need to let him be a peacock and fly. He attends counseling for officers who’ve used their weapons in the line of duty and appears to be the only one remorseful for his shooting, and also dispised by the entire department  he mistakenly shot Derek Jeter!

Somewhere around town, a masked man hops into an unattended crane and drives a wrecking ball into a jewelry store. He and a some other masked people run into the store and rob it, shortly pursued by Highsmith and Danson. They chase the group up to a roof where they rappel back down to the street and cut the cord. Highsmith and Danson decide to aim for the bushes, but as they fall, you realize that there aren’t bushes around and have stupidly plummetted to their deaths.

At their funeral, as Hoitz tries to convince Gamble that they should replace Highsmith and Danson, rival partner team Fosse and Martin claim they will be the new replacements. They whisper forcefully to one another to not attract attention, which leads to Martin attacking Hoitz. They have a silent struggle that the rest of the department quietly hides and instigates until their captain Gene Mauch (Michael Keaton) breaks it up and whispers his disapproval. He advises them that if they want to be the big cops, they need to investigate, like Highsmith and Danson used to.

The next day, a call comes through about a homicide, which Fosse and Martin immediately jump on. Hoitz angrily argues that they should go, and asks why Gamble is so scared, then calls him into the hallway and draws his gun, forcing Gamble to leave with him. Inside Gamble’s red Prius, Hoitz tries to get them pumped with some rock music, but Gamble puts on the Little River Band instead. When Hoitz insults him, Gamble yells “America” and guns the pedal into the crime scene and on top of the body, covering the Prius in a lot of cocaine that was on the crime scene.

The leave the crime scene with the car still covered and head back to the station. Gamble tells Hoitz that he is a real cop; he’s been investigating David Ershon (Steve Coogan), a Wall Street investor, who owns several buildings that are under construction, but has never sought scaffolding permits. When Hoitz refuses to go with Gamble to arrest him, Gamble draws his wooden gun grabs his wooden gun (his real one had been taken by the captain after being tricked into firing it in the office) and threatens Hoitz. Hoitz mocks him, so Gamble hits him with the wooden gun.

They arrive at the hotel where Ershon is holding a press conference. Ershon is on the run from several unhappy clients who’s money he’s lost and comes upon Gamble and Hoitz who arrest him. While enroute to the police station, armed men stop them and take their guns, shoes, phones, and Gamble’s car with Ershon in the backseat. A female with the group flirts with Gamble while disarming him. (This is a running gag throughout the movie is hot women checking out Gamble). Ershon begs them to stop the men, but they drive off. On their walk back to the station, Hoitz and Gamble call a truce. When they arrive at the station, they are called into the captain’s office where they come face-to-face with Roger Wesley (one of the men who took Ershon) and Don Beaman, a man who says he’s Ershon’s lawyer. Wesley apologizes and claims that he’s part of a private security company and believed that Gamble and Hoitz were kidnapping Ershon. Gamble and Hoitz are given back their weapons and shoes, and once Wesley and Beaman leave, they tell Mauch that they believe Wesley’s lying because Ershon was in fear for life. They decide to continue the investigation at Gamble’s house, at which point Gamble warns Hoitz about his plain, big wife.

At Gamble’s house, Hoitz meets Sheila Gamble (Eva Mendes), who’s really hot. Hoitz doesn’t believe Sheila is Gamble’s wife and continually asks who she really is. After it settles, he makes a lot of funny comments, obviously smitten, and repeatedly says good-bye to only her, though Gamble’s also saying good-bye.

The next day, the pick-up Gamble’s car from the impound (it had been found the day before and was used for an orgy by homeless people), and find lottery tickets and Gamble’s iPhone in the car. At lunch, they scratch off the tickets and realize that someone dialed his ex-girlfriend when they took the car. She’s crazy and tries to seduce him, while her husband is in next room. Gamble grabs her phone and he and Hoitz bolt from the house, with his ex and her hubby following behind. They hear voicemail from her phone, which is Wesley telling Ershon that he has to come up with $32 billion dollars to repay his employer. Ershon claims to have found an investor that will give him that money, which he will falsely state has been lost and will in turn be given to Wesley’s employer, Lendell Global.

They head to a pub, where they try to piece together the investigation, trying to connect Ershon, Wesley, and some clues they found that involves the Lottery. They find that Ershon works with an office in Fair Lawn, NJ and decide to head there. Hoitz cuts out early, leaving Gamble to wonder why. Hoitz arrives at a ballet studio where he begs his ex-girlfriend Francine to give him another chance. He pulls out some dance moves to prove he can dance just like her partner. Gamble arrives to back Hoitz up, but makes things worse, so they leave. They have another argument about Gamble’s interference.

Once they arrive at the office, it blows up in front of them, knocking them off their feet. A few yards away, Wesley puts away a remote and says that should scare them away before driving off. While they’re cleaning up, Gamble says he’s tired of all of this and wants to give up. Hoitz asks Gamble what he’s hiding from, so Gamble explains that while at college he helped a classmate, who was paying for school by dating guys. He made sure the dates went okay and they she was being paid. Hoitz interrupts, shocked the Gamble was a pimp. Gamble refuses to believe that. He further explains that he came up with the name Gator to better help the girls, and realized one day that he’d gotten out of control. Two of his girls brought him to the emergency room where her met Sheila and vowed never to lose control again, so he graduated a became a police accountant.

They head to Ershon’s office, where he casually hands them Knick’s tickets. At the game, they realize they’ve been bribed and head back, and he again hands them tickets, this time to Jersey Boys. Again, once they’re there, they realize they’ve been bribed. They arrive at Ershon’s office and he’s ready with something else, but they pow-wow and Hoitz tells Gamble they are gonna play good cop, bad cop. Hoitz starts his bad cop routine, but a scared Ershon agrees to only speak with Gamble because he looks reasonable. Gamble goes nuts and starts destroying the office before tackling Ershon. After they leave, Wesley and his men ambush them and knock them out.

They awaken to find their guns, phones, and shoes have again been taken from them. They notice they are in the desert. They arrive in Las Vegas and call Mauch to explain. He yells at them for going to Ershon against his orders. They get back to NY and head back to the station, where they see Fosse and Martin begin interviewed for catching the jewel theives from earlier in the film. They say they’ve recovered about $74 thousand dollars in diamonds. Gamble interrupts that there’s millions in diamonds there. They tell him to shut up and get into the office, where the DA is waiting. He tells them to lay off Ershon as well. Mauch gives Hoitz back his gun, but instead of giving Gamble the wooden one back, gives him a rape whistle. He tells them to give their evidence to the SEC and “don’t go chasing waterfalls” (he’ll continue to quote TLC songs throughout the movie and not understand when they refernce them).

At home, Gamble and his wife get into a fight after he starts acting like Gator. She tries to calm him down and tells him she’s pregnant. When he doesn’t, she kicks him out. He and Hoitz meet up and head out to a bar, where it pans to different moments of the night with them drinking, firing guns and peeing while standing on a pool table. Hungover from their night of drinking, Hoitz and Gamble arrive at the SEC office to find Mr. Beaman to be the SEC agent. He promises them that his association with Ershon will not conflict with his investigation. They leave and head back to the office. Hoitz gets upset and breaks his computer, and explains that he’s always so angry because he keeps screwing up. They get a call about a jumper and it’s at the SEC building.

They arrive and realize Beaman is about to jump. He’s drunk and Gamble tries to talk him down. They fail to stop him from jumping, and get into a lot of trouble with Mauch, who decides to separate them. He says that Ershon’s not targeting the lottery; he’s trying to hook-up with the lottery girl. Mauch tells them that Hoitz is going to traffic and Gamble IS TO walk a beat. Gamble and Hoitz again argue, ending with Hoitz telling Gamble he’s not a cop. Gamble decides to continue with his investigation. He goes back to the jewerly store and finds that a law firm for Lendell Global was also destroyed at the same time, but was sectioned off by Roger Wesley and his group. Gamble goes to Mauch and asks for his gun back. He breaks into Hoitz’s apartment and asks him to help him finish this. Hoitz’s is reluctant because he likes traffic, but agrees anyway. They find Mauch, who works parttime at Bed, Bath, and Beyond, and ask why he’s stopping them from investigating. He tells them that he’s trying to protect his job, and stay out of trouble. They eventually convince him to back them up.

The next day, they head to Ershon’s office and ambush his meeting, which is filled with all of the people he owes money to. They learn that his new investor is one of their own who’s in charge of deciding where the policemen’s pension is going to be invested. A shootout starts and they grab Ershon and head to his secret penthouse. He informs them that the deal with the pension’s done and will be transferred at exactly 9am the next morning where it will be distributed to all of his other clients, so they must get him to his bank before this happens. Gamble decides to find Sheila and they reconcile, while Hoitz calls Francine to ask for another chance.

The next morning, they head out and are chased throughout the city by all of the different groups. They are blocked in, so they reverse, somehow end up on the top of a parking lift while the rest pass them by. They drive off and are chased through the Chelsea Piers, where they get the golfers to help them by hitting a helicopter with golfballs until it loses control. From here they get to the bank, where they threaten to shoot the clerk if he puts through the transfer. There, Wesley and his men ambush them. Hoitz disarms and beats up all of them except Wesley, who’s still holding a gun on them. Hoitz grabs Ershon’s tie and tells Wesley that if he shoots either of them, he kills Ershon too. Wesley shoots each of them in arm and is about to kill them and the clerk when Mauch arrives with the rest of the police.

We learn that the government issued tarp funds to help Lendell; Ershon was sent to prison; Wesley was charged with Beaman murder, having forced him to drink a bottle of gin then forced him onto the ledge; Terry and Francine were married, and he asked Sheila to be his best man, though she declined. As they prep for their next case in an oldschool Charger, Hoitz learns that Gamble lost his virginity to Heather Locklear.