Mr. Kite, elderly mayor of the small town of Heartland, recounts the history of Heartland's celebrated marching band. Sgt. Pepper and his Lonely Hearts Club Band brought happiness through its music, even causing troops in World Wars I and II to stop fighting. On August 10, 1958, Sgt. Pepper died of a heart attack at the unveiling of a new weather vane in his likeness. Sgt. Pepper left the band's magical musical instruments to the town; so long as they remain in Heartland, its people will live happily ever after. He also left his musical legacy to his grandson, Billy Shears. Billy forms a new Lonely Hearts Club Band with his three best friends: brothers Mark, Dave, and Bob Henderson. Billy's charming but avaricious half-brother, Dougie, serves as the band's manager for ("Sgt. Pepper's Lonely Hearts Club Band").
Heartland loves the new band ("With a Little Help from My Friends"), and soon Big Deal Records president B.D. Hoffler invites them to Hollywood with the promise of a record deal ("Fixing a Hole"), which the band accepts ("Getting Better"). Billy bids farewell to his sweet hometown girlfriend, Strawberry Fields ("Here Comes the Sun"). Once in Hollywood, B.D. introduces the band to their new labelmates, sexy singers Lucy and the Diamonds, and they negotiate the contract over a sex-and-drug-fueled dinner ("I Want You (She's So Heavy)"). Hitting it off with Lucy, Billy all but forgets about Strawberry. The band quickly succeeds ("Good Morning, Good Morning"), with hit records and sold-out concerts produced and performed as quickly as they succeeded ("Nowhere Man"/"Polythene Pam"/"She Came In Through the Bathroom Window"/"Sgt. Pepper's Lonely Hearts Club Band (Reprise)").
Meanwhile, villainous Mr. Mustard and his henchman, the Brute, drive to Heartland in their computer- and robot-equipped van, under orders from the mysterious FVB to steal the magical instruments from City Hall and distribute them among FVB and its affiliates ("Mean Mr. Mustard"). Without the instruments, Heartland quickly degenerates into a hotbed of vice and urban decay. Strawberry takes an early morning bus to Hollywood ("She's Leaving Home") to warn the band ("Lucy in the Sky with Diamonds"/"Oh! Darling"). Mustard, who has a crush on Strawberry, follows. In Hollywood, the band and Strawberry steal Mustard's van and use its computer to locate the stolen instruments, recovering the cornet from the deranged, money-driven anti-aging specialist Dr. Maxwell Edison ("Maxwell's Silver Hammer"), and the tuba from mind-controlling cult leader Father Sun ("Because"). Billy is knocked out in each battle, with nothing except Strawberry's love keeping him going ("Strawberry Fields Forever"). The group easily find the bass drum, which Mr. Mustard kept for himself in the van. However, the computer and robots malfunction and self-destruct before they can locate the final missing instrument, the saxophone.