The story is divided among three distinct time periods: the early 1920s, the early 1930s and the year 1968. The story is also jumps back and forth between these times and is summarized chronologically here.
In 1968, David "Noodles" Aaronson (Robert De Niro), returns to the Lower East Side of Manhattan, NY following a prolonged absence. He has been called back to his old neighborhood under mysterious circumstances; he's received a notice from a local rabbi telling him that the cemetery in his old neighborhood is being closed and the remains of those buried there are being moved. He sets himself up in with a room in a bar owned by an old friend, Fat Moe (Larry Rapp), and begins to investigate the summons he received. Noodles is suspicious of the letter, thinking he's been called back to see to the reburial of his old friends, Patrick "Patsy" Goldberg (James Hayden), Philip "Cockeye" Stein (William Forsythe), and Max Bercovic (James Woods), who he used to be in a gang with. Noodles believes someone is seeking revenge against him.
In the earliest time period, the early 1920s, the boys grow up in poverty in a Jewish neighborhood of the Lower East Side. They ostensibly work for a young local gangster named Bugsy, however, Noodles and his friends Patsy, Cockeye and Dominic, have ambitions to strike out on their own. One day, while attempting to roll a drunk, they are foiled in their plot by Max, who is just moving into the neighborhood with his mother. He keeps the drunk's pocket watch and leaves the boys to be harassed by a policeman, Whitey (whom the boys call "Fartface") who constantly bullies them. Noodles finds Max later and demands the watch back. Whitey happens by and takes the watch for himself. Noodles and Max come to admire each others resolve and decide to be friends. Though Noodles and Max share the leadership of the gang, it is Max who is the more charismatic and makes most of the decisions for them.
One day Patsy spies Whitey walking along the rooftops of the neighborhood and follows him. Patsy immediately realizes that Whitey is going to see their pre-teen (and physically matured) friend, Peggy, who prostitutes herself. The boys catch Whitey in the act and photograph him; Patsy quickly disappears with the film plate. Whitey acquiesces to their demands that, as the new gang in the area, he pay them as much in tribute as he does Bugsy and that he do some enforcement work for them. They also get their watch back from him and make him pay for Noodles and Max to have sex with Peggy.
Noodles has long desired to be romantically involved with a girl, Deborah (Jennifer Connelly), who lives in his building and whose father owns the local kosher restaurant in the neighborhood. While using the men's room in the restaurant, David often spies on Deborah through a small hole in the wall while she practices her ballet steps. Deborah, however, mostly ignores his advances, with the exception of an intimate moment they share when the restaurant's closed during Passover.
The boys become something of a success in their neighborhood, thieving houses and stores and rolling more drunks and other weaker types for small earnings that are substantial for themselves. When Bugsy hears that there's another gang that isn't under his control, he and his thugs horribly beat Noodles and Max . Undaunted, the boys meet with a local Italian mobster, Capuano, and show him an invention of Noodles' that will allow Capuano to keep all the imported cargo he illegally deals even after his ships crews are forced to throw it overboard by harbor customs agents. The first time the boys use Noodles invention, it works perfectly and the boys are overjoyed at the cargo that floats to the surface. Max falls overboard and doesn't surface for a seemingly long amount of time. Noodles, worried that his friend has drowned, looks for him and is perturbed when Max finally appears.
The invention is a success and the boys become very wealthy, receiving 10% of Capuano's earnings. They rent a train station locker and stash their cash earnings in a leather briefcase, promising that they will only withdraw or deposit funds from the locker when they are all present and that the key will be kept by Fat Moe. On their way back from the station, they're attacked by Bugsy, who this time carries a pistol. Dominic is the only member of the gang who is shot by Bugsy (being the smallest, he is unable to run for cover as fast as his compatriots) and dies in Noodles' arms. Noodles retaliates and stabs Bugsy with a switchblade several times before a policeman tries to stop him - Noodles, still in a fit of rage about Dominic, stabs the cop and is arrested. He is sentenced to 12 years. His friends turn out to see him delivered to the child reformatory.
In the early 1930s, Noodles is released from prison and is picked up by Max. Max explains that he and the rest of the gang have set themselves up in an undertaking business. However, the mortician's parlor is a front for their real business, bootlegging liquor, which has made them rich. According to Max, they run the most popular speakeasy in the city; they hide the scotch they serve in the building's steam heating system. A party is held for Noodles on his return and Max introduces him to some new associates, Frankie Manoldi (Joe Pesci) and his partner Joe (Burt Young). Frankie and Joe want the gang to rob a diamond broker's they own in Detroit. During the heist, Noodles hits and rapes a woman, Carol (Tuesday Weld), who works there; she's a masochist who provokes Noodles into beating her; Noodles also does so despite a stern warning from Joe himself not to abuse her. The gang meets with Joe to give him the diamonds and kill him and his men on Frankie's orders. Noodles, unaware of the deal that Max made with Frankie to murder Joe, is quite angry with Max; his reasoning is that their gang should not be liable to anyone like Frankie and should operate independently. Also, Noodles is concerned that one day Frankie may want Noodles or Max to eliminate the other. Max assures Noodles it will never happen. As they drive away from the scene, Noodles foolhardily drives their car off a long pier into the bay. (A restored scene shows everyone except Noodles escaping the car and surfacing. After a few minutes, the guys are worried that Noodles may have been killed by a nearby dredging machine but he appears soon after, a reflection of Max tricking him when they were teenagers.)
The gang then begins to aid a local union leader, Jimmy "Clean Hands" O'Donnell (Treat Williams), who has made a career of standing up to corrupt labor leaders, particularly a man named Crowning. After rescuing Jimmy from Crowning's thug, Chicken Joe, who is about to burn him alive, the gang offers their assistance to Jimmy, who initially refuses their help, not wanting to deal with men who operate in bootlegging, drugs or prostitution.
The gang turns their attention to a local labor strike being engineered by a celebrity police captain, Vincent Aiello (Danny Aiello). Aiello is being manipulated by the factory owners into allowing his officers to protect the scab workers the owners have allowed into their factory. The gang concocts a brilliant and diabolical scheme to switch Aiello's newborn son (his family's only boy after four girls) at the hospital - Noodles calls him just after he discovers the switch (the gang switched his boy for a girl in the nursery) and tells him to call off his officers and let the workers and management work out the strike. However, when Patsy tries to remember which baby they switched Aiello's boy for, he can't; he's lost the switch list with the child's number on it. The mix-up doesn't faze the gang, however, & they agree to simply give Aiello the number of a random boy from the ward, coldly laughing over the fates of some of the children they'd mixed up.
During the time that the gang is expanding their business dealings, Noodles rekindles his romance with Deborah (now played by Elizabeth McGovern). He arranges for a lavish vacation for them both at a posh resort that is closed for the season. Noodles reveals his love for Deborah, however, she is still as reluctant to get romantically involved with him, and plans to leave for California to study acting. On their return trip, during a romantic encounter in their limousine, Noodles forces himself on Deborah and rapes her over her protests. Ashamed, he orders the driver to take her home. Some time later, Deborah boards a train to California; Noodles, from a distance in the station, watches her leave; she closes the compartment blind when she spots him.
While calling Max & Noodles for assistance, Jimmy is nearly killed on the street by Chicken Joe. The gang retaliates, shooting at Crowning outside his club, killing his bodyguards, including Chicken Joe. With a wounded leg, Jimmy is crippled for life but is able to continue his career. While they celebrate with Jimmy in the hospital, Jimmy's attorney, Shark, tells the gang that Prohibition may soon end and they should think about entering legitimate business with their large fleet of bootlegging trucks, with Jimmy acting as their front. Max seems to like the idea, however, Noodles is unconvinced, still adhering to his old mantra of not working for anyone but themselves. Max suggests that Noodles' idea of business is too archaic and that they need to expand to make more money, but Noodles still adheres steadfastly to his street code.
In late 1933, Prohibition approaches its end, and the gang find themselves out of work. Not wanting to go into legitimate work, Max reveals an audacious plan to rob the Federal Reserve bank in Manhattan. Noodles thinks the plan is too outrageous, knowing that it almost certainly would get him and the rest of the gang killed. By this time, the woman Noodles sexually assaulted in Detroit, Carol, has joined the brothel that Peggy runs (in conjunction with the gang's speakeasy) and has become Max's girlfriend. She tries to convince Noodles to get Max to abandon his plan or tip the police to get Max arrested to give him time to think over the scheme's absurdity. Noodles plans to alert the police about a liquor exchange Max has planned with Cockeye and Patsy, which is set to take place a short time after the gang's party in celebration of the end of Prohibition. Noodles does so and, when Max joins him in the office, provokes Max into a fight by suggesting his friend is crazy; it is a vulnerable fact of Max's life that his father was mentally unbalanced and died in a sanitarium. Noodles shows up at the site of the liquor buy and sees that Patsy and Cockeye have been killed and it appears Max has been burned beyond recognition. After returning to Fat Moe's bar and finding his girlfriend Eve murdered and Moe horribly beaten (depicted in the first scenes of the film), he retrieves the key to the locker at the train station. At the station, he finds that the money has been replaced with newspapers. Puzzled, Noodles buys a one-way bus ticket to Buffalo and leaves.
During his sleuthing in 1968, Noodles finds out that his friends were moved to a different cemetery and an elaborate mausoleum was constructed for them. He finds the key to the train station locker on a plaque inside that states Noodles himself put the plaque and key there to honor his friends. He goes to the locker and finds the same leather case and more money inside. A note inside the case says "Advance payment for your next job". According to news reports, a senator named Chris Bailey is under investigation for corruption; several witnesses set to testify against Bailey have all died under mysterious circumstances. Noodles suspects a connection between Bailey and the money left to him. Before visiting the senator's house under invitation, he talks to Carol who tells him that Deborah is once again living in the New York City area and is now a famous stage actress. Noodles visits her and the two have a lengthy conversation. Deborah's most important revelation is that she and Senator Bailey are together and have a grown-up son, also named David, who very closely resembles Max when he was younger.
Noodles goes to Bailey's Long Island mansion and meets directly with the Senator, who reveals himself to be Max. Max had faked his own death during the liquor exchange where he was "killed" and has, for the past 30 years, created the Bailey persona as a disguise. With the impending investigation for corruption, Max tells Noodles that he wants to be assassinated and that Noodles is the only person to do it (hence the money in the suitcase as an "advance for the next job"). Noodles refuses, saying that he feels betrayed and has felt guilty for the entire span Max was gone, which is punishment enough. He leaves through a secret passage; on the street outside Bailey's estate, he catches a glimpse of Bailey standing by the road. A garbage truck drives by, the augers in the back clearly visible, suggesting but not concluding for certain that Bailey has thrown himself into them to his death.
The film ends in the 1930s time period, with Noodles in a Chinese opium den. Laying down after a few puffs from an opium pipe, he smiles as the closing credits run.
(Note: It has been suggested by fans, critics and some film historians that the 1968 sequences were all part of an opium-induced dream experienced by Noodles.)