NOTE: This spoiler was submitted by Jeremy.
1948, L.A. - John O'Mara (Josh Brolin) narrates saying that every man has a badge in life, and the badge Micky Cohen (Sean Penn) wears is one he got from his rise to power in L.A. after having an influence on the Italian criminals and after doing some time as a boxer. At the Hollywoodland sign, Cohen establishes how ruthless he is by tying a gangster to two cars, which then rip him in two, and he's eaten by some coyotes.
Elsewhere, on a sunny day in L.A., O'Mara watches as a creep named Mitch lures a pretty young woman with him after telling her that she looks like Lauren Bacall and telling her he's holding auditions for something. O'Mara follows him to his apartment, which happens to be Cohen's territory. While Mitch is assaulting the woman, O'Mara gets hassled by two goons in the elevator, who he manages to kill. He enters Mitch's apartment and beats him and his boys unconscious and rescues the woman.
He goes to turn them in, but because he didn't have a warrant, the three goons are gonna walk. As O'Mara watches them leave, Sgt. Jerry Wooters (Ryan Gosling) watches with him and notes that O'Mara always seems to encounter some trouble like this.
The trio of goons go back to the apartment where Mickey is. We learn that they're meant to bring in girls to become prostitutes, but now that O'Mara knows where to find them, they're done. To ensure this won't happen again, Cohen has his boys burn Mitch and his guys in an elevator.
Later that evening, Jerry goes to a nightclub where he meets with a guy named Jack Whelan (Sullivan Stapleton), who also happens to be a wanted criminal. They see Mickey sitting with his guys, which include the judge and some cops that he bribed, as well as his girlfriend, Grace Faraday (Emma Stone). She catches Jerry's eye, and as she goes to have a smoke, he follows her and lights it for her. After some smooth talk, she is won over by him.
O'Mara goes home to his wife Connie (Mireille Enos), who is pregnant and not happy that O'Mara gets hurt so badly on his job. Despite this, she still takes care of him while helping him bathe, and he appreciates it.
Jerry and Grace wake up in bed together and share a cigarette. She warns him that Cohen would be furious if he found out about them sleeping together.
Chief Bill Parker (Nick Nolte) calls O'Mara in with a mission. He is to form a team in order to take Cohen down. They will hide their identities as cops, and they will do whatever it takes to get Cohen, but Parker tells O'Mara not to kill him, because with Cohen dead, it would only bring in more criminals.
Connie is once again unhappy when she learns that her husband is putting this team together, because she's afraid Cohen will kill him. However, she eventually decides to help him as he goes through the files of several cops.
First, O'Mara meets with Jerry, who doesn't seem particularly interested, before moving onto a guy in Burbank named Coleman Harris (Anthony Mackie), who demonstrates his knife-throwing abilities by getting one crook in a club. Next, O'Mara meets Max Kennard (Robert Patrick), who is quick with a gun. With him is Navidad Ramirez (Michael Pena), a Mexican detective who only Kennard will work with since the other detectives avoid him due to his heritage. Finally, they get Conway Keeler (Giovanni Ribisi) to join them.
The squad's first plan of attack is to infiltrate an Indian casino of Cohen's by storming the place like thugs. This proves to be a very stupid plan when real cops go after them. O'Mara and Harris are caught and arrested.
Cohen goes to meet with another gangster named Jack Dragna (Jon Polito), who is angry with him for killing Tommy Russo (the guy who got torn in half). Cohen gets angry when being pressed by Dragna, and he declares that L.A. is his destiny. As this happens, Jack Whelan tells Grace to take it easy with Jerry, since he is "a sheep in wolf's clothing."
Jerry walks down a street where he encounters a shoeshining kid named Pete who continuously hassles him to shine his shoes so he can make some money. Jerry relents, but as this happens, he notices a couple of suspicious characters, who proceed to open fire. Jerry tells Pete to run, but the kid gets shot and dies. Devastated, Jerry goes into a club where Cohen is dancing with Grace. She sees that he is about to kill Cohen, but Jack pulls him out fast and tells him how bad this idea is.
Meanwhile, Kennard, Keeler, and Ramirez try to break O'Mara and Harris out of prison as Jerry also goes inside. The trio's attempt to break the bars out of the window fails, but the lights get cut, and Jerry gets O'Mara and Harris out.
The squad goes to a private area to do some shooting at some cans. While Kennard is a natural, Ramirez isn't quite so great at it. Kennard tells him to shoot where his target will be, as opposed to where he is.
They go into Cohen's home one evening and bug the place to listen in on his activities. Grace comes in and finds Jerry, so he leaves, but not before stealing a kiss.
One of the squad's first major busts occurs one evening when they learn from a guy in Burbank (the same guy Harris stuck a knife in) that Cohen has a shipment of coke being handled in a quiet area. The squad comes in, and fires at the goons, and a chase ensues. They catch two of Cohen's guys, and O'Mara shoots both of them in the legs and pushes them in a ditch.
Another bust happens when they infiltrate a nightclub, burn Cohen's money, and shoot up any gangster they see (this is presumably the scene filmed in place of the theater shooting scene).
The squad proves to be successful with striking blows to Cohen's organization, but it's not long before Cohen becomes increasingly violent and furious at his guys for not having the squad situation under control. He believes there is a traitor in his midst and orders his guys to kill them and the squad. He has a guy search his home for the device that the squad used to eavesdrop on him.
O'Mara and Keeler hear that a drop is being made in Chinatown. The squad goes there, and O'Mara nearly walks into a trap as a goon spills a bunch of gas from under a truck. Jerry pulls out a gun and fires into the air to lure O'Mara away in time as a thug lights the gas with a cigarette, causing the truck to blow up. Another shootout occurs, with some thugs dying, but the guys in the squad survive.
At the spot where Keeler is listening for any more from Cohen, he hears Mickey bragging about when he robbed a convenience store at the age of 9 by beating the clerk with a bat. Soon enough, one of Cohen's guys comes in and strangles Keeler to death. O'Mara and Jerry find him, and O'Mara covers his body. He is forced to go to his family and inform them of his death, and he comforts Keeler's distraught son.
Soon after, the goons go to O'Mara's house and open fire. Connie is woken up by the bullets, but she manages to escape. As O'Mara gets home and finds the cops there, he rushes in and is scared when he sees blood on the floor and finds Connie in the tub. It turns out that she gave birth, and O'Mara is now a proud father.
Grace becomes a target when Cohen suspects her of betraying him. He has two goons go to a bar and nearly kill her with acid, but Jerry fights them off and drops the acid on one of the goons' pants.
Jack tries to get Grace out of town, but Mickey and the two goons from the bar come in. Jack hides her and beats up the goons, but Mickey shoots him in the stomach, then kills him after pushing him in the pool. Grace sees this and quietly flees.
Parker tells O'Mara that they're looking to replace him (Parker), and they'll relieve O'Mara of his duty for all the damages caused by their operation. O'Mara is forced to send Connie and their newborn baby away for their protection. At night, Jerry visits him and tells him that he's still a hero, but O'Mara sees himself as a fool. A cab pulls up, and Grace steps out, and she embraces Jerry. She tells him that she witnessed Cohen kill Jack, and her testimony would give the squad a better reason to go after him.
O'Mara gets the crooked judge to sign the warrant for Cohen's arrest. He and Jerry learn that Cohen's staying at the Park Plaza Hotel that is full of his goons and that there is no way they can get Cohen out. O'Mara rounds up Harris, Kennard, and Ramirez, and they go after him.
After calling Cohen out on the bullhorn, he sends his goons out and another shootout occurs. O'Mara and Jerry get into the hotel and try to take Cohen, but he shoots his way out of the hotel. Outside, Kennard gets shot, but the other goons are killed. O'Mara goes after Cohen's car driven by his bodyguard, Karl. O'Mara manages to shoot Karl and get the car to crash into a park fountain.
Karl gets out of the car to kill O'Mara, but a dying Kennard, with the help of Ramirez, shoots and kills Karl. Finally, O'Mara and Cohen engage in hand-to-hand combat. Cohen nearly takes him down with his boxing abilities as onlookers and journalists gather onto the scene, but O'Mara gets the upper hand and defeats Cohen. He is finally arrested.
O'Mara narrates the epilogue - Cohen got sent to prison and was assaulted by Jack's friends. Grace's testimony was what put him away. Parker was given credit for Cohen's takedown, and there was no mention of the Gangster Squad. Jerry and Grace remained a couple. O'Mara concludes by reiterating his earlier statement that every man has a badge to wear, and his is with the law, but it's time to put it away for now.
We see that he's at a beach, and he tosses his police badge into the ocean, and then goes to enjoy the afternoon with Connie and their baby.