On his thirtieth birthday, Josef K. awakens to discover that he is under arrest for an unspecified crime. Willem and Franz, two guards dressed in black, occupy the living room of the lodging house where K. lives. After the guards insist they are mere lowly officials and have no information about the reason for his arrest, K. meets with the guards' superior in the house and he informs K. that his arrest shouldn't prevent him from going about his life and work as usual.
After a day at the bank where he holds a prominent position, K. returns home and talks about his case with Frau Grubach, the proprietor of the lodging house. After consoling him, Grubach upsets K. when she cast aspersions on fellow lodger Fräulein Bürstner's sexual morality. K. stays up until Fräulein Bürstner returns home and asks her to speak with him in her room. He apologizes for the inquisition that took place there, of which she had been ignorant, and ends up kissing her vigorously. She receives his advance with exhaustion and indifference.
On the following Sunday morning, K. attends the first hearing of his trial. He arrives at a derelict tenement building and realizes he wasn't given the exact address. He finds the attic courtroom by knocking on random apartment doors. The examining magistrate reprimands him for being tardy and begins the hearing by addressing K. by a different person's name. K. lambasts the court's disorder and attempts to humiliate the magistrate in order to impress the people assembled to watch the hearing. One side of the room applauds him while the other remains silent. During an interruption, K. enters the crowd to discover that the men are not of the public but members of the court, and wear matching badges. He leaves in anger, believing that the crowd merely pretended to be split into two factions.
K. returns to the court the following Sunday but discovers there is no hearing scheduled. He meets a washerwoman, who is the wife of a court usher. She attempts to seduce him and offers to help with his case if he will take her away from the horrible court, where both the magistrate and a legal student have been making advances on her. The student arrives and takes the woman away from K. K. then meets the woman's husband, who gives him a tour of the court offices. K. learns that other defendants more or less live in the waiting room, where they grow weak and confused. K. himself grows faint in their presence and needs to be led outside.
While working at the bank, K. opens a storage room to find Willem and Franz being caned by a man wearing black leather. The distraught guards say that K.'s complaints about them before the court have led to them being thrashed as punishment. K. says he didn't know his words would lead to these consequences for them, and he offers to bribe the thrasher, but the latter refuses to stop thrashing the men. K. leaves and returns the next day to discover the exact scene about to play out again.
Having heard rumors about K.'s trial, K.'s uncle Karl visits from the country to assist K. with his case. They visit Herr Huld, a lawyer who is very ill and bedridden. A court official happens to be in Huld's room already. As the men discuss K.'s case, K. is drawn away when Leni, Huld's nurse, smashes a plate outside the room. She seduces K. and the two have sex. She gives him a key to the house. K. is then reprimanded by his uncle, who says his disrespectful behavior has harmed his profile in Huld and the official's eyes.
K. slumps on his desk and considers how he has continued to visit Huld but has grown frustrated with Huld's reluctance to disclose what progress has been made in the preliminary discussions Huld has pursued with court officials. K. believes he must dismiss Huld and take charge of the case by submitting a detailed summary of his entire life. K.'s reverie is interrupted when one of his clients visits and tells K. to meet with a painter who could be helpful.
K. leaves work to visit Titorelli, who is a court painter employed by the court to paint portraits of judges. Titorelli offers helpful but dispiriting information about the court, saying that he has never heard of anyone's case leading to acquittal; K.'s only options are to keep his case active indefinitely by keeping the sensitive judges happy, or temporarily to stop the proceedings with the risk that he could be arrested again at any moment.
At Huld's home, K. meets Block, a corn merchant who is a fellow defendant and client of Huld's. While Leni attends to Huld, Block informs K. that he has been fighting his case for five years and has employed five lawyers other than Huld. Block was once successful, but he has lost his livelihood fighting his case. K. rushes to Huld's room to tell him he is dismissing the lawyer from his case. Huld gives him time to reconsider and invites Leni and Block into the room. K. watches as Huld demonstrates his power by humiliating Block and treating him like a dog.
K. is tasked with showing an important Italian client of the bank's around the capital. They arrange to meet at a cathedral, but the Italian doesn't arrive. A priest enters the pulpit of the dark church and address K. by name. He informs him that he is the prison chaplain, and he has come to talk about the case, which he understands is not going well. The priest tells K. a parable (earlier published as "Before the Law") about a man who spends his entire life waiting to enter a door to the Law only to learn from the guard in front of the door that no one else has tried to enter because the door was made especially for the man. K. believes the parable is about how the man is deceived, while the priest is more sympathetic to the guard.
On the night before K.'s thirty-first birthday, two men employed by the court arrive at his room. They take him by the arm to a quarry beyond the city limits. In the moonlight, they strip K.'s clothes and push his head down on a flat stone. While one man holds his neck, the other plunges a long, thin butcher's knife into K.'s heart and twists. As he dies, K. cries out, "Like a dog!"