Galadriel Gilly Hopkins is en route to yet another foster home in Thompson Park, Maryland, with her social worker, Miss Ellis. At 11 years of age, she has spent the better part of her life being bounced from one set of foster parents to the next. While Gilly is extremely bright and self-reliant, she is also bitter, angry and cynical from years of repeated abandonment and rejection. She fiercely clings to the idea that her birth mother, Courtney Rutherford Hopkins, a flower child, loves her and will return to care for her someday.
At first, Gilly loathes her new foster mother, Mamie Trotter, as much as the previous. Trotter refuses to bow to Gilly's manipulative tactics, forcing her to become a functioning member of the household. Gilly's only pleasure is in bullying the other foster child in the home, a skittish seven year old boy named William Ernest Teauge. While learning to live with Trotter and William Ernest, Gilly must also confront her own issues with racism: she dislikes being around African-American people, but both her teacher, Miss Harris, and Trotter's closest friend, a blind man named Mr. Randolph, are black.
While living at the Trotter home, Gilly initially gets into trouble as usual, scuffling with other students at school and leaving a racist and rude homemade card for her teacher. The only student at school who tries to strike up a friendship with her is a loathsome girl named Agnes Stokes, who follows Gilly around in spite of her constant insults.
Gilly quickly hatches two plans to escape. She learns that her mother is in San Francisco after Courtney sends her a postcard with a return address, and writes her a scathing letter about the foster home, pleading to be rescued. While visiting Mr. Randolph's personal library, she discovers that the old man has a cache of money hidden in his bookshelf. She manages to pilfer a significant amount of money and tries to use it to purchase a bus ticket to San Francisco, but is picked up by the police. She only decides to return to Trotter's house when William Ernest pleads with her to come home. In spite of her desire to leave, Gilly eventually discovers she actually likes her new foster family and teacher. She begins teaching William Ernest to read and defend himself against bullies; she also reads Mr. Randolph books from his large library. In school, Gilly comes to an understanding with Miss Harris and begins to excel in her school studies.
Just as Gilly settles into her new life, she is uprooted once again. Courtney has received Gilly's letter, and has requested that the state relinquish custody of Gilly to her biological grandmother. Gilly requests to stay with Trotter, but the matter is out of her hands, and she is taken to Virginia to live with her grandmother, who wishes to be called Nonnie.
Gilly bonds with Nonnie and tries to adapt to her new environment. When she learns that her mother is coming to Virginia for Christmas, she is excited because she believes that her longtime dream of a reunion is coming true. Courtney arrives, but Gilly is shattered because she immediately learns that her mother isn't going to stay in Virginia or take her back to San Francisco, she didn't even want to come for the holidays, and she only consented to visit because Nonnie paid for her ticket. After calling Trotter one last time and begging to go back, Gilly finally accepts her new home. Gilly is heartbroken, but decides she will cope with the situation, just to make Trotter proud.