On the morning of his thirtieth birthday, Josef K., the chief cashier of a bank, is unexpectedly arrested by two unidentified agents from an unspecified agency for an unspecified crime. Josef is not imprisoned, however, but left "free" and told to await instructions from the Committee of Affairs. Josef's landlady, Frau Grubach, tries to console Josef about the trial, but insinuates that the procedure may be related to an immoral relationship with his neighbor Fräulein Bürstner. Josef visits Bürstner to vent his worries, and then kisses her. Josef is ordered to appear at the court's address the coming Sunday, without being told the exact time or room. After a period of exploration, Josef finds the court in the attic. Josef is severely reproached for his tardiness, and he arouses the assembly's hostility after a passionate plea about the absurdity of the trial and the emptiness of the accusation.
Josef later tries to confront the presiding judge over his case, but only finds an attendant's wife. The woman gives him information about the process and attempts to seduce him before a law student bursts into the room and takes the woman away, claiming her to be his mistress. The woman's husband then takes K. on a tour of the court offices, which ends after K. becomes extremely weak in the presence of other court officials and accused. One evening, in a storage room at his own bank, Josef discovers the two agents who arrested him being whipped by a flogger for asking K. for bribes and as a result of complaints K. made at court. K. tries to argue with the flogger, saying that the men need not be whipped, but the flogger cannot be swayed. The next day he returns to the storage room and is shocked to find everything as he had found it the day before, including the whipper and the two agents. Josef is visited by his uncle, a traveling countryman. Worried by the rumors about his nephew, the uncle introduces K. to Herr Huld, a sickly and bedridden lawyer tended to by Leni, a young nurse who shows an immediate attraction to Josef. During the conversation, Leni calls Josef away and takes him to the next room for a sexual encounter. Afterward, Josef meets his angry uncle outside, who claims that Josef's lack of respect for the process has hurt his case.
During subsequent visits to Huld, Josef realizes that he is a capricious character who will not be much help to him. At the bank, one of Josef's clients recommends him to seek the advice of Titorelli, the court's official painter. Titorelli has no real influence within the court, but his deep experience of the process is painfully illuminating to Josef, and he can only suggest complex and unpleasant hypothetical options, as no definitive acquittal has ever been managed. Josef finally decides to dismiss Huld and take control of matters himself. Upon arriving at Huld's office, Josef meets a downtrodden individual, Rudi Block, a client who offers Josef some insight from a client's perspective. Block's case has continued for five years and he has gone from being a successful businessman to being almost bankrupt and is virtually enslaved by his dependence on the lawyer and Leni, with whom he appears to be sexually involved. The lawyer mocks Block in front of Josef for his dog-like subservience. This experience further poisons Josef's opinion of his lawyer. Josef is put in charge of accompanying an important Italian client to the city's cathedral. While inside the cathedral, a priest calls Josef by name and tells him a fable (which was published earlier as "Before the Law") that is meant to explain his situation. The priest tells Josef that the parable is an ancient text of the court, and many generations of court officials have interpreted it differently. Two days before Josef's thirty-first birthday, two men arrive at his apartment to execute him. They lead him to a small quarry outside the city, and kill him with a butcher's knife. Josef summarizes his situation with his last words: "Like a dog!"