A young British schoolmistress, Adela Quested, and her elderly friend, Mrs. Moore, visit the fictional city of Chandrapore, British India. Adela is to decide if she wants to marry Mrs. Moore's son, Ronny Heaslop, the city magistrate.
Meanwhile, Dr. Aziz, a young Indian Muslim physician, is dining with two of his Indian friends and conversing about whether it is possible to be a friend of an Englishman. During the meal, a summons arrives from Major Callendar, Aziz's unpleasant superior at the hospital. Aziz hastens to Callendar's bungalow as ordered but is delayed by a flat tyre and difficulty in finding a tonga and the major has already left in a huff.
Disconsolate, Aziz walks down the road toward the railway station. When he sees his favourite mosque, he enters on impulse. He sees a strange Englishwoman there and yells at her not to profane this sacred place. The woman, Mrs Moore, has respect for native customs. This disarms Aziz, and the two chat and part as friends.
Mrs. Moore returns to the British club down the road and relates her experience at the mosque. Ronny Heaslop, her son, initially thinks she is talking about an Englishman and becomes indignant when he learns the facts. Adela, however, is intrigued.
Because the newcomers had expressed a desire to see Indians, Mr. Turton, the city tax collector, invites numerous Indian gentlemen to a party at his house. The party turns out to be an awkward business, thanks to the Indians' timidity and the Britons' bigotry, but Adela meets Cyril Fielding, headmaster of Chandrapore's government-run college for Indians. Fielding invites Adela and Mrs. Moore to a tea party with him and a Hindu-Brahmin professor named Narayan Godbole. At Adela's request, he extends his invitation to Dr. Aziz.
At Fielding's tea party, everyone has a good time conversing about India, and Fielding and Aziz become friends. Aziz promises to take Mrs. Moore and Adela to see the Marabar Caves, a distant cave complex. Ronny Heaslop arrives and rudely breaks up the party.
Aziz mistakenly believes that the women are offended that he has not followed through on his promise and arranges an outing to the caves at great expense to himself. Fielding and Godbole were supposed to accompany the expedition, but they miss the train.
Aziz and the women explore the caves. In the first cave, Mrs. Moore is overcome with claustrophobia. But worse than the claustrophobia is the echo. Disturbed by the sound, Mrs. Moore declines to continue exploring. Adela and Aziz, accompanied by a guide, climb to the next caves.
As Aziz helps Adela up the hill, she asks whether he has more than one wife. Disconcerted by the bluntness of the remark, he ducks into a cave to compose himself. When he comes out, he finds the guide alone outside the caves. The guide says Adela has gone into a cave by herself. Aziz looks for her in vain. Deciding she is lost, he strikes the guide, who runs away. Aziz looks around and discovers Adela's field glasses lying broken on the ground. He puts them in his pocket.
Then Aziz looks down the hill and sees Adela speaking to another young Englishwoman, Miss Derek, who has arrived with Fielding in a car. Aziz runs down the hill and greets Fielding, but Miss Derek and Adela drive off without explanation. Fielding, Mrs. Moore, and Aziz return to Chandrapore on the train.
At the train station, Aziz is arrested and charged with sexually assaulting Adela in a cave. The run-up to his trial releases the racial tensions between the British and the Indians. Adela says that Aziz followed her into the cave and tried to grab her, and that she fended him off by swinging her field glasses at him. The only evidence the British have is the field glasses in the possession of Aziz. Despite this, the British colonists believe that Aziz is guilty. They are stunned when Fielding proclaims his belief in Aziz's innocence. Fielding is ostracised and condemned as a blood-traitor. But the Indians, who consider the assault allegation a fraud, welcome him.
During the weeks before the trial, Mrs. Moore is apathetic and irritable. Although she professes her belief in Aziz's innocence, she does nothing to help him. Ronny, alarmed by his mother's assertion that Aziz is innocent, arranges for her return by ship to England before she can testify at the trial. Mrs. Moore dies during the voyage. Her absence from India becomes a major issue at the trial, where Aziz's legal defenders assert that her testimony would have proven the accused's innocence.
Adela becomes confused as to Aziz's guilt. At the trial, she is asked whether Aziz sexually assaulted her. She has a vision of the cave, and it turns out that Adela had, while in the cave, received a shock similar to Mrs. Moore's. The echo had disconcerted her so much that she became unhinged. At the time, Adela mistakenly interpreted her shock as an assault by Aziz. She admits that she was mistaken, and the case is dismissed. (Note: In the 1913 draft of the novel, EM Forster had Aziz guilty of the assault and found guilty in the court but changed this in the 1924 draft to create a more ambiguous ending.)
Ronny Heaslop breaks off their engagement. Adela stays at Fielding's house until her passage on a boat to England is arranged. After explaining to Fielding that the echo was the cause of the whole business, she departs India, never to return.
Although he is vindicated, Aziz is angry that Fielding befriended Adela after she nearly ruined his life. Believing it to be the gentlemanly thing to do, Fielding convinces Aziz not to seek monetary redress from her. The men's friendship suffers, and Fielding departs for England. Aziz believes that he is leaving to marry Adela for her money. Bitter at his friend's perceived betrayal, he vows never again to befriend a white person. Aziz moves to the Hindu-ruled state of Mau and begins a new life.
Two years later, Fielding returns to India. His wife is Stella, Mrs. Moore's daughter from a second marriage. Aziz, now the Raja's chief physician, comes to respect and love Fielding again. However, he does not give up his dream of a free and united India. In the novel's last sentences, he explains that he and Fielding cannot be friends until India is free of the British Raj.