Told in parallel plot lines whose alternating chapters eventually converge into a single narrative, Kafka on the Shore begins with Kafka Tamura, the protagonist, running away from home on his fifteenth birthday. Kafka's storyline involves him taking a bus from Tokyo to Takamatsu on the island of Shikoku. On the bus he meets Sakura, a twenty-one-year-old woman he is attracted to and believes might be his long-lost sister. In his first-person narration, Kafka cryptically alludes to the curse he is trying to escape but worries is in his DNA. Eventually he reveals he is trying to escape the Oedipal prophecy his father once announced: that Kafka is fated to kill his father and sleep with his mother and sister.
The novel's even-numbered chapters tell the story of Nakata, an elderly disabled man. Through military documents released to the public, the reader learns of the childhood accident that put Nakata in a coma and took away his ability to read or write. While picking mushrooms with classmates during the Second World War, Nakata discovers bloody towels that his teacher tried to hide in the woods after suddenly getting her period. When he shows the towels to her, she becomes embarrassed and enraged and begins hitting him until he loses consciousness. His eyes move side to side but he is unresponsive. Soon the other children lose consciousness as well. The military investigates the matter, wondering if the children were the victims of an enemy attack. The case remains unsolved, and only Nakata has lasting injuries from the Rice Bowl Hill Incident.
In the present day, Nakata has retired from his job as a furniture maker. He lives on a government subsidy and spends his free time searching for missing cats. Since the accident, Nakata learned that he can speak with cats, a skill he uses in his searches. While looking for a cat named Goma, Nakata is brought by a black dog to the house of a metaphysical entity who takes the form of Johnnie Walker, the whisky brand's mascot. Walker has been stealing cats and eating their hearts to collect their souls, which he says he is using to make a flute. He asks Nakata to murder him. Nakata doesn't want to, but an intense feeling overcomes him and he picks up a steak knife and uses it to stab Walker to death. Having rescued Goma, Nakata returns the cat and turns himself in to the police. He tells the story of the murder with honesty, but the officer assumes Nakata is crazy and making it up. Nakata also has no blood on his hands. Nakata announces that it will rain fish the next day. The officer is dumbfounded the next day when fish fall from the sky. He also learns that a famous sculptor—Koichi Tamura—was found dead, stabbed to death by a steak knife.
Kafka takes refuge in the Komura Memorial Library in Takamatsu, where he meets Oshima, a young transgender librarian, and Miss Saeki, a middle-aged woman Kafka suspects could be his missing mother. When Kafka wakes up from a blackout to discover he is covered in blood, he stays the night at Sakura's and then returns to the library. Coincidentally, Kafka's father Koichi is found murdered. Even though he is too far from Tokyo to have killed Koichi, Kafka worries he may have entered a dream portal and killed Koichi.
When the police track Kafka to the library, Oshima brings Kafka to his family cabin in the forest to lie low. After Kafka returns, he starts living in a spare room in the library annex. Miss Saeki's fifteen-year-old ghost begins visiting him at night. Kafka and the real-life Miss Saeki begin a sexual relationship after she initiates sex with him one night while apparently sleepwalking. As he falls in love with her, Kafka obsessively listens to a song called "Kafka on the Shore," which she recorded as a young woman. Miss Saeki and Kafka treat each other as surrogates for people they have lost: she seems to view Kafka as the boyfriend she lost when she was twenty, and Kafka views Miss Saeki as the mother who abandoned him.
After trying and failing to turn himself in, Nakata leaves Tokyo by hitching a ride. He doesn't know why, but he is compelled to travel west. With the help of Hoshino, a truck driver who wears Hawaiian shirts, he follows his intuition to Takamatsu. Once there, Nakata gets Hoshino to locate "the entrance stone," a large white rock that Nakata knows he has to find. Having located it with the help of a metaphysical entity who takes the form of Colonel Sanders of the KFC franchise, Hoshino flips the heavy stone over, opening the entrance to the other world. Between long naps that Nakata takes, the pair go searching for their next destination, eventually arriving at Komura Memorial Library.
Oshima panics when the police track to Takamatsu an elderly man (Nakata) who is suspected of Koichi's murder. Oshima brings Kafka back to the cabin, and warns Kafka that he believes Miss Saeki may be preparing to die, and Kafka is likely hastening her inevitable death. While staying at the cabin, Kafka goes deep into the labyrinthine forest despite Oshima's warning that he may get lost and be unable to find his way back. Kafka meets two soldiers who have been in the forest since WWII; they are still in uniform. They lead him through the "entrance" and Kafka stays in a cabin in a small settlement in the valley.
Nakata and Miss Saeki greet each other as though they have been fated to meet. She acknowledges that she opened the portal long ago. Nakata says he only knows that he has to set things right. She gives him a manuscript of all her memories to burn. He and Hoshino burn the papers in a dry riverbed and then return to the apartment Colonel Sanders set up for them. Nakata becomes sleepy. In the morning Hoshino discovers that Nakata has died. Hoshino isn't sure what to do, knowing he has to close the entrance somehow. Eventually a cat appears on the balcony and speaks with Hoshino, who now realizes he can speak to cats. As instructed, Hoshino destroys the large snake-like creature that slithers out of Nakata's mouth, having used his body as a portal. Hoshino inadvertently closes the entrance by flipping the stone, which he was trying to lift in order to crush the snake creature with it. Hoshino thanks Nakata's dead body for helping him see life in a new way and sets off with the creature in a bag that he intends to burn.
While in the village, Kafka meets Miss Saeki's fifteen-year-old and fifty-year-old selves again, but now they are not ghosts. They speak of the place as limbo, the neutral space between life and death. Speaking to Miss Saeki as though she is his mother, Kafka forgives her for abandoning him when he was young. Although compelled to stay, Kafka returns from the forest feeling more at peace in the world because he has confronted his subconscious fears. Oshima's brother drives Kafka back to the library, where Kafka learns from Oshima of Miss Saeki's death. He says goodbye to Oshima and heads back to Tokyo to continue high school. Before leaving town he calls Sakura and they make plans to meet in Tokyo in the summer. Kafka sheds a tear on the train back to Tokyo.