Kimball O’Hara, Jr., known as "Kim," is a poor, Irish orphan in Lahore, British India. Prior to his parents' deaths, his father worked as an Irish army officer, and his mother as a nursemaid. Although Kim is white, he blends in like a native among the Lahore streets and speaks Urdu as if it were his native tongue. Kim is supervised by a local Lahore woman who runs an opium den. One day, Kim spots a Buddhist lama from Tibet outside the Lahore Museum. Kim volunteers to be the man's chela, or disciple. The lama is searching for the River of the Arrow, one of the Four Holy Sites of Buddhism. Kim decides to accompany the lama south on his mission.
On his journey south, Kim stops at the home of Mahbub Ali, a horse trader. This is a pivotal event, as it signifies Kim's first entry into the world of espionage. Mahbub Ali works as a spy for the British empire, and since Kim is traveling south, he asks him to deliver a classified letter on his behalf. Kim and the lama head to Umballa, where the protagonist delivers Mahbub Ali's letter. While in Umballa, Kim has a session with a Hindu priest who ruminates on topics of destiny and fate. The priest shares that the prophecy made by Kim's father prior to his death will come true: Kim will be led to a Red Bull where he will then find his life's course. When Kim and the lama continue to search for the River of the Arrow, the prophecy does come to fruition. While staying at the home of a Kullu woman they meet on their travels, Kim and the lama encounter white soldiers planting a flag in the ground. Kim is shocked when he sees the image on the flag—a red bull on a green field, true to his father’s prophecy.
When Kim approaches the campsite to learn more, he is greeted by a reverend. The reverend rummages through the documents draped around the protagonist's neck and finds that he knows Kim's late father. The British infantry wants to become Kim’s “guardian.” Kim doesn’t want to be separated from the lama, but the lama is intent on journeying alone to the River of the Arrow. Kim is sent to enroll in school with the goal of one day being enlisted in the military. When Kim begins school, he is mocked by his peers for his lack of "Britishness." He only wants to be reunited with the lama.
Kim is persuaded by Colonel Creighton to enroll in another school named St. Xavier's. Kim concedes, as it is located further south (which means he can be geographically closer to the lama). Colonel Creighton realizes that Kim possesses numerous traits that would make him a successful spy, and he begins grooming him to work for the secret service. Although Kim enjoys his time at St. Xavier's, he still hatches a plan to escape from campus. Colonel Creighton worries about Kim's whereabouts, and Mahbub Ali later finds the boy begging on the streets of Umballa. Mahbub Ali convinces Kim to re-enroll in school until he is hired, and the two journey to another town called Simbla where Kim meets a man known as Lurgan Sahib. Lurgan tests Kim in a variety of areas to determine if he is fit for a spy career. Kim passes each test, and he is introduced to "the Babu" to finalize his training.
Kim re-enrolls in school, though he spends his holidays going on adventures and training with Mahbub Ali and Lurgan. Before formally completing his studies, Kim is unenrolled from St. Xavier's so he can begin working. Mahbub Ali decides to take Kim traveling for six months as a "trial period" for his new career. The Babu dresses Kim in a costume of a chela, and he reunites with the lama at a Jain temple. The lama is impressed by Kim's growth and resourcefulness, and he hopes that Kim will join him again on his search for the River of the Arrow. Kim, who is wearing an amulet around his neck that signifies his involvement in the British Secret Service, is forced to put his spy skills to the test on a train to Delhi—he encounters a spy named E23 and aids him on his mission. The Babu, who approaches Kim in disguise, praises the protagonist for his quick thinking and resourcefulness. The Babu tells Kim about a new mission involving the Five Kings in the Himalayas. Kim decides to take the lama with him on his journey.
The Babu, the lama, and Kim begin climbing the Himalayas. The group meets up with two men—one from Russia and one from France. The lama begins explaining his drawing of the Great Wheel of Existence to the Europeans, but his holistic description is soon thwarted by the Russian man’s desire to purchase the drawing. When the lama refuses to sell his drawing, things escalate quickly. The Russian man strikes the lama in the face, harming him. Kim retaliates and the European duo quickly flee the scene on foot. Kim pursues them and fires shots with his new revolver. The lama is upset by the violence that surrounds him, but he is even more disappointed in his own desire to avenge his aggressor. He considers himself far from the path of enlightenment and hastily makes a plan to return to his quest for the River of the Arrow.
A woman in the village of Shamla arranges transportation for Kim and the maimed lama, and the two head south once again. On their journey, Kim and the lama are confronted by existential feelings, sickness, and sensations of guilt. When they arrive back at the home of the Kullu woman, both take measures to alleviate their suffering—Kim sleeps for 36 hours while the lama fasts and meditates. The lama has a vision that reveals the location of the River of the Arrow. However, he is unable to complete his journey alone—he needs Kim by his side.
At the end of the story, the lama smiles as “a man may who has won Salvation for himself and his beloved.” Ultimately, the lama has found a way for his religious faith to coexist with his love for Kim. The two bathe in the River of the Arrow, having finally achieved their goals together.