As the title implies, the main character in this novel is Tom. Tom is spending the summer at his aunt and uncle's apartment, because his brother has the measles and he can't stay at home. At the beginning of the story, he is having a miserable and lonely time. To make things worse, he is being kept indoors and away from people, because he was also exposed to measles, and nobody knows whether or not he is contagious.
Things change when he comes across a magical garden that is only accessible after midnight. Here he meets Hatty, who is the other significant character in the story. The strange thing about Hatty is that she seems to be a year older, rather than a day older, every time Tom sees her.
Getting back to Tom himself, Hatty seems to awaken a kind, more considerate version of the young boy. While the two have their fights, including arguing about which of them is a ghost, having Hatty around makes life infinitely more bearable for Tom. At the end of the book, Tom finds out the truth about the identity of Hatty and is reassured that he did not imagine his encounters with her.