In Winter 1974. a young Thaddeus Sivana and his older brother are driven home by their father. While playing with his magic 8 ball, Sivana is magically transported to the Rock of Eternity, where he meets a wizard, who introduced him to the mystical statues containing the spirits of the Seven Deadly Sins: Pride, Greed, Lust, Envy, Gluttony, Wrath, and Sloth. The last of a council of 7, the wizard spent centuries searching for a new champion. Put to a test to see if he is pure of heart, Sivana attempts to touch the eye of envy, failing the test. Transported back to the car, he causes a scene in which his brother hits him, and his father to crash on ice, injured. The magic 8 ball reads "find me".
A few years before modern day, Billy is at a carnival with his mother, who plays darts in vain to get a tiger. Afterwards, Billy loses a pendant ball he has and chases after it, separating from his mother. Lost, he is picked up by police who gets him to a foster home.
In present day Philadelphia, Billy Batson lures and traps police officers into a pawn shop, using their computer in hopes of searching the address of his long lost mother. Traveling, he is disappointed. He is found and brought to a social services worker who puts him with the Vasqueze family, and the other siblings, Eugene, Darla, Pedro, Mary and Freddy.
In the office building of Sivana Industries, a woman tells a doctor about her experience and shares a video. Sivana takes the video to his office where he had a project that tracked people who had similar sightings around the word, and the video enabled him to find access to the wizard's lair. When questioned about it, Sivana turns the doctor into dust. He uses the symbols to access the lair, confronts the wizard, and touches the energy ball by Enzy, unleashing the Seven Deadly Sins. They form into an eye and sits at home and latches itself into his right eye.
At school, the foster children shows Billy around the school, as he adjusts. At lunch Freddie sits with Billy and after trying to pester him for a few minutes in attempts to get him to known him better. Outside, bullies drive him and hit Freddie. Billy stands up to the bullies and hits them with Freddie's walking stick, and runs into the subway to avoid them. While on the train, symbols appear and he enters the Rock of Eternity. The wizard reveals he had previously given his to someone else, but had turned evil and killed numerous people and released the seven deadly sins. The wizard vowed to search for someone who possessed a pure of heart, leading him to search for millennia. He chooses Billy, who has to say the word Shazam. Billy says the word, and transforms into the champion Shazam, and the wizard disappears. Shazam returns to Philadelphia and returns to the foster home and meets with Freddie. Testing all the abilities, lightning, super speed, and strength. They enter a store and stop an armed robbery. Heading home, he discovers he reverts to his other form by saying Shazam.
At Sivana industries, Dr Sivana barges into a corporate meeting hosted by his brother and father, who had lost his legs in the accident from the night in 1974. A confrontation between the siblings results in Sivana throwing his brother out of the window and showing off the sins in his eyes, slaughtering everyone in the room, including his father.
Freddie posts videos of Shazam's powers, going viral. Freddie and Billy are in school and skip school when Billy poses as Shazam to check them out. Leaving, they get around to test fire immunity, flight, and strength. Happy, they walk through a mall where they use the lightning ability to charge people's cell phones, get sodas for free, attempt to purchase a lair from a real estate agent, and going to a strip club. He comes out and says we need more money. They go to an ATM, zapping it and taking some of the money, using it to purchase merchandise.
Next day at school - the bullies begin to mess with Freddie and Billy again until Freddie tells them he knows the new hero "Red Cyclone" - they don't believe him but he promises and tells them that he'll get him to show up to lunch tomorrow. Freddie and Billy get into a bit of an argument over him just assuming and trying to use Billy for his powers. That night at dinner the father asks the family what they think of the new hero - everyone gives input and Freddie takes a dig at Shazam and then him and Billy get into a bit of an argument leaving the rest of the family confused.
At school the next day, Billy decides not to attend school because he wants to find his mother, despite Freddie asking for lunch. Shazam does various things, taking selfies, and showing off lightning for money. He sees and saves Mary from being hit by a car, and talking to her makes him realize she is upset that, because of college, she will have to leave her family. Shazam accidentally reveals he knew her name and housing situation, but leaves. Freddie finds Shazam and tries to talk to him, yet Shazam tries to diffuse it, shooting lighting that hits the tires of a bus across the city, sending it off the side of the bridge. Catching it, Shazam puts it on the concrete, only to be promptly told he's not using his powers right. Hearing the commotion, Dr. Sivana shows up and demands the powers that Shazam possesses. Brushing him off, Shazam is promptly thrown around and lands through a mall, while discovering his ability to fly. Sivana hunts him down, but Shazam transforms back into Billy and runs. Freddie is there and is taken hostage by Sivana, who demands to be taken to Billy.
Billy shows up, and they know with Eugene telling him where his mother is; she is only 2 subway stops away. Billy rushes out of his house, with his foster parents in tow. Back at the house, Sivana shows up with Freddie and traps the children. Billy arrives at his mother's apartment complex. His mother informs Billy he was intentionally abandoned on that day, and saw him with the police and that he would be better cared for by others since she was 17. Controlling his emotions in the face of the heartbreaking reality that his stubborn years-long search for his mother was for nothing, Billy quietly reassures his mother that he is fine, but he has to return to his real family. However, Billy gives his mother the key-chain compass she gave him years ago with a comment mixed with regret, resentment and understanding about her, "You might need it more than me." Leaving, he receives a call and Sivana tells him to come home. Billy jumps off the apartment building and transforms to Shazam and flies home.
Shazam decides to give up the power to save his family and Sivana opens a magical door to the Rock of Eternity. Taking the wizard's staff, Sivana unleashes the 7 deadly sins. The siblings enter the cave and distract Sivana long enough for them to run and exit into a winter carnival.
Sivana and the sins attack the Carnival, shooting at a Ferris wheel, almost tipping over. Sivana and Shazam fight all around the carnival. Getting a hold of the wizard's stick, Shazam and his family, yell his name, and transmits his power to his family, transforming them into the Shazam family, each an adult superhero. Each fighting one sin, Shazam engages with Sivana while flying through skyscrapers.
As it goes to tip over - Freddie flies in and saves the last two people on it - the bullies. Shazam and Sivana end up on a rooftop and Shazam goads the one deadly sin who remained -- Envy. It rips itself out from Sivana's eye and Shazam yells Shazam, hurting it. Sivana is knocked off the roof, now mortal. Shazam grabs Sivana and drags him to the carnival, ripping the magical eye out. Saving the day, the Shazam family basks in the cheers of the crowd, takes the eye back to the lair, and return the sins for keeping. Shazam and Freddie decide this is their lair. Back at the foster home, everyone returned to their original form and are watching a news cast of the carnival instance, with Santa Claus describing the event. The foster family all talk and laugh and Billy finally feels happy and safe accepting a family.
At school, Freddie sits down at lunch and the entire table leaves so all his siblings come and sit next to him. The bullies show up and ask if he's still friends with Red Cyclone - Shazam shows up and tells the school how Freddie showed him everything it means to be a hero and that he also brought another friend - Superman. In the mid-credits scene, Sivana in a prison cell doodling the symbols all over the wall in a futile effort to reopen the portal until he's interrupted by the alien caterpillar, Mister Mind, who tells him of the pillars of evil that will come together.
In the post credits scene, Shazam tries to talk to fish a la Aquaman.