Stereotypical Barbie ("Barbie") and a wide range of fellow Barbies all reside in Barbieland, a matriarchal society where all women are self-confident, self-sufficient, and successful. While their Ken counterparts spend their days engaging in recreational activities at the beach, the Barbies hold all important job positions such as doctors, lawyers, and politicians. Beach Ken ("Ken") is only happy when he is with Barbie and seeks a closer relationship, but Barbie rebuffs him in favor of independence and female friendships.
During a dance party, Barbie is suddenly stricken with worries about mortality. The next day, she finds she can no longer complete her usual routine and discovers her feet have gone flat and she has cellulite. Weird Barbie, a wise but disfigured outcast, tells her that to cure her affliction she must travel into the real world and find the child playing with her. On her way to the real world, Barbie finds Ken stowed away in her convertible, and reluctantly allows him to join her.
Arriving at Venice Beach, the pair cause multiple antics and are arrested, alarming the Mattel CEO, who orders their capture. Barbie tracks down her owner, a tween girl named Sasha, who criticizes her for encouraging unrealistic beauty standards. Distraught, Barbie discovers that Gloria, a Mattel employee and Sasha's mother, is the catalyst of her existential crisis. Gloria began playing with Sasha's Barbie toys while experiencing her own identity crisis, inadvertently transferring her concerns to Barbie. Gloria and Sasha rescue Barbie from Mattel's CEO and his subordinates, and the three travel together to Barbieland.
Meanwhile, Ken learns about the patriarchal system, and feels important and accepted for the first time. Returning to Barbieland, he persuades the other Kens into taking over and the Barbies are subjugated into submissive roles such as maids, housewives and agreeable girlfriends. Barbie arrives and tries to convince Ken and the Barbies to return to the way things were, only to be rebuffed. She becomes depressed, but Gloria inspires her with a speech about the problems of being a woman. With the encouragement of Sasha, Gloria, Weird Barbie, Allan, and other discontinued dolls, the Barbies free themselves from the Kens. They manipulate them to fight amongst themselves, allowing the Barbies to regain their previous positions of power and prevent the Kens from altering the Barbieland constitution to enshrine male superiority. However, the Barbies, having now experienced the same objectifying treatment the Kens had suffered, decide to allow them some minor power in a circuit court, with more equalized treatment in the future.
Barbie and Ken apologize to each other and acknowledge their failings. Ken bemoans that he has no identity or purpose without Barbie, to which Barbie encourages him to find an autonomous identity. Barbie, who remains unsure of her own purpose and identity, meets with the spirit of Mattel co-founder Ruth Handler, who explains that Barbie's story has no set ending and her ever-evolving history surpasses that of her roots.
Barbie decides to become human and return to the real world. Some time later, Gloria, her husband, and Sasha take Barbie, now going by the name "Barbara Handler", to her first gynecologist appointment.