The film is told from the perspective of Cindy (Jennifer Garner) and Jim Green (Joel Edgerton), as they explain their experience with a boy named Timothy (CJ Adams) in an effort to persuade an adoption agency to allow the couple to adopt a child.
Cindy, who works in the town's local museum, and Jim, who is employed at the town's historic pencil factory, reside in the fictitious town of Stanleyville, self-described as "the pencil capital of the world". The Greens are informed by doctors that they are unable to conceive. Distraught by the news, Jim convinces Cindy to dream up their ideal child and write the child's characteristics and life events on slips of notepad paper.
The couple place the notes inside a wooden box and bury it in their backyard garden. After an immediate thunderstorm, which seemingly affects only their property, a ten-year-old arrives at their home claiming the Greens as his parents. After finding the box they buried smashed to pieces around a large hole in the ground where they originally buried it, and finding the boy inside their house, covered in mud, they realize that the boy, named Timothy, is actually a culmination of all their wishes of what their child would be. The Greens also discover that Timothy has a startling feature: he has leaves growing on his legs, which he can only cover up by wearing long tube socks.
The next day, at a family picnic, Timothy is introduced to members of his family: Brenda Best (Rosemarie DeWitt), Cindy's pompous sister; James Green Sr. (David Morse), Jim's estranged father; and Mel (Lois Smith) and Bub (M. Emmet Walsh), Cindy's paternal aunt and uncle. The parents take Timothy to their friend and town botanist, Reggie (Lin-Manuel Miranda), where they learn that Timothy's leaves cannot be removed.
Timothy begins to attend school, where he meets Joni Jerome (Odeya Rush), a girl he encounters during a bullying incident. Jim takes Timothy to confront the bullies and Timothy is invited to a birthday pool party. There, Joni Jerome tries to take off his socks, and is kicked in the head by Timothy, though they later become friends. Meanwhile, the town's pencil factory, the largest employer in Stanleyville, begins laying off its employees. Timothy convinces Cindy and Jim to design a prototype for a new pencil in an effort to keep the pencil-producing business viable.
Unbeknownst to the parents, one of Timothy's leaves falls off each time he fulfills one of the qualities listed on the original slips of paper. Timothy eventually reveals to Cindy and Jim that his time of existence is short and that he will eventually disappear. During another intense thunderstorm, he vanishes from their house and all they can find of him is the pile of paper slips.
The Greens' meeting with the adoption counselor concludes with Cindy presenting a letter that Timothy left them before leaving. In the letter, he explains to them what he did with each of his leaves that fell off, with a montage sequence showing each person whose life Timothy touched. After an unspecified amount of time, the adoption counselor is shown pulling up to the Greens' house in a car with the little girl who is to become the Greens' daughter, Lily.