In a world where extremely wealthy parents can purchase lifelike android robots called "whatnots" to serve as their children's classmates, 11-year-old Maximilian "Max" Sterling has grown up believing every child he knows is real. Whatnots, invented by a reclusive genius named Frances Miranda Gonzagaga, are designed to look and behave like perfectly well-mannered human children so that rich kids never risk the unpredictability of real friendships. Max's billionaire parents chose whatnots for him at birth: His mother wanted to spare him from the cruelty she herself inflicted as a rich child, and his father wanted to shield him from the greed that wealth attracts.
On Max's first day of kindergarten, a lively, messy girl named Josie West plops down beside him, asks if he likes jumping in mud puddles, and scribbles out most of the letters on his name tag, renaming him "Max." The two bond instantly while 13 other children sit perfectly still. The narrator reveals what Max does not know: Those 13 children are whatnots, but Josie is human.
Josie's backstory explains how she ended up in a whatnot school designed for wealthy children surrounded by android classmates. Born the same night as Max, Josie lost her mother to inadequate care at a charity hospital. Her grief-stricken father, a poor laborer, accepted a desperate bargain from a mysterious veiled woman: In exchange for letting Josie live at the school and pretend to be a whatnot, she could receive the excellent education he could never otherwise afford. Josie sleeps in a hidden room beneath a fake charging station, sees her father only three weeks each summer, and lies about her identity every day.
For six years, Max and Josie are inseparable, but their bond rests on an imbalance Josie cannot reveal. She hides her poverty, her motherlessness, and the fact that she sleeps in the school's basement. At the end of fifth grade, during a pool party at Max's mansion, Josie whispers that she may not attend the same school next year because of "whatnot rules," regulations requiring children to be weaned from whatnot companions by the end of sixth grade. She tells Max to find out how to circumvent the rules, then dives away. That evening, Max discovers a note Josie hid under his laptop insisting that she is real.
Max tries researching "whatnot rules" online but receives an access-denied message. At midnight, he sneaks out and rides to the house he has always assumed is Josie's, only to find it dark and empty, her belongings on the curb. A limousine arrives carrying a veiled stranger and Nurse Beverly, his longtime caretaker. At home, Max's parents and the veiled woman reveal that every child he has ever known was a whatnot. Max screams that Josie is real, but his parents insist she was only a machine, and a contractual clause forbids further contact.
Meanwhile, Josie arrives at her father's cramped apartment, having surrendered her cell phone and all school possessions. She cannot contact Max or know what the Whatnot Corporation, the company running the whatnot program, might text him while pretending to be her. Looking out the window, Josie spots Ivy, a quiet, artistically gifted classmate she always noticed most among the supposed whatnots. Josie races downstairs, and the two girls simultaneously realize neither is an android: Both are real children who spent years pretending to be whatnots. Before their panicked parents separate them, Ivy whispers her address to Josie.
Josie secretly visits Ivy's apartment, where she meets Ivy's older sister Lucinda, who attended a different whatnot school as the fake-whatnot companion to a rich girl named Ashley. Lucinda delivers a staggering revelation: There are no real android whatnots in any of their classes. Every child was a human pretending to be a machine, because android technology was never sophisticated enough to fool a real child for years. Lucinda warns them to stay silent or risk losing their scholarship opportunities.
At Max's house, Nurse Beverly, who never signed the corporation's agreements, leads Max to the school. There they encounter Lola, an android with a partially broken face who has been Josie's invisible caretaker for six years, delivering meals and tucking Josie into bed each night without her knowledge. The narrator then reveals her own identity: She is Lola, one of Gonzagaga's very first whatnots, originally assigned to a cruel rich child who bullied her, and later reassigned to watch over Josie.
Max's parents arrive at the school with the veiled woman and demand to buy the Whatnot Corporation. The woman refuses. At the same moment, Josie and Ivy slip through the front door. Josie overhears the refusal and bursts into the office; Max crashes out of a closet where he has been hiding. Their actions trigger a lockdown: Metal plates seal the room, and the veiled woman collapses into the floor, revealed to be an android emissary rather than the real Gonzagaga. Josie studies Lola's broken face and realizes Lola was the mysterious figure who cared for her every night. Mrs. Sterling also recognizes Lola as the childhood companion she bullied years ago and tearfully apologizes; Lola forgives her. The narrator reveals that Mrs. Sterling was the cruel rich child from Lola's past. A transparent wall drops, separating Max, Josie, and Lola from the adults, and a see-through elevator plunges them underground.
They arrive in an enormous room of server cabinets arranged as a maze. The maze administers a series of tests: Max and Josie refuse to dismantle Lola for trail markers, and Josie screams that footage of their unkind moments does not matter. Deeper inside, Max encounters Ivy and objects to trusting her, still believing she is a whatnot. Ivy challenges him, and Max admits he was always afraid Josie would prefer Ivy to him. Josie then reveals the full truth of her poverty to Max. Thousands of bully-model androids surround the group, screaming personalized insults that exploit each person's deepest insecurities. Lucinda and Ashley arrive to help after Lucinda followed Josie to the school and called Ashley; security guards caught both girls and deposited them in the maze. Together, the group declares the bullies hold no power, and the androids retract into the floor.
The maze leads to dozens of corporate-management androids that have been running the Whatnot Corporation in Gonzagaga's name. They pose a final question: Why did Gonzagaga invent whatnots? Each person guesses wrong until Josie realizes the answer: Gonzagaga invented the first whatnot because she wanted a friend. The androids freeze, and a door clicks open.
Behind it lies a hospital room containing the real Frances Miranda Gonzagaga, an extremely old, frail woman lying alone. Asking to be called Mira, she confirms she invented whatnots out of loneliness but discovered androids could never truly be friends. She began placing real children in whatnot classes, always hoping one might become her friend. When Mira tries to sign documents transferring the corporation to Josie, Josie rips the papers in half. The room erupts with confetti: This refusal was the true final test, proving friendship cannot be bought. Mira explains the transfer will proceed electronically, but Josie refuses again, insisting that Mira must live, fix her own mistakes, and accept real friendship.
In the resolution, Mira's health problems prove treatable. She retakes control of the corporation, deactivates the management and bully androids, and keeps the schools open. She divides her wealth among the families whose children pretended to be whatnots. Lola's face is repaired, and she moves in with Josie and her father. In the epilogue, Max hosts another pool party where no one keeps secrets. Josie's father has purchased the house beside the school and converted it into apartments for families of former fake whatnots. When Max asks if they will be friends forever, Josie assures him they are already making their own world, and they have been all along.