The film takes place during a heatwave in the middle of summer in post-war Tokyo. Rookie homicide detective Murakami has his Colt pistol stolen in a crowded trolley ride. He chases the pickpocket, but loses him. Remorsefully, he reports the theft at headquarters. After some preliminary investigation, he then goes undercover in the city backstreets for days, trying to infiltrate the illicit arms market. He eventually picks up the trail of a gun racket. Forensics discover that the stolen gun was used in a recent crime, and Murakami is partnered up with the veteran detective Satō. After questioning a suspect, Satō and Murakami get a tip that their suspect may be a fan of baseball. They stake-out a local high-attendance baseball game looking for a gun dealer named Honda. When they confront Honda, he points them to Yusa, a disenchanted war veteran who has resorted to desperate crime. They investigate Yusa's sister's house and his sweetheart, showgirl Harumi Namiki, which does not lead to immediate leads. Murakami's gun is used again in a crime, this time as a murder weapon. They continue to question Namiki at her mother's house. She is still reticent to talk, so Satō leaves to investigate Yusa's trail, while Murakami remains behind hoping that Namiki's mother can persuade her to begin cooperating. Satō comes across a hotel, Yusa's most recent hideout. He places a call for Murakami, but, just as he is about to reveal Yusa's location, the criminal tries to shoot Satō dead in the hotel phone booth before he makes a run for it. Satō, though badly wounded, tries to give chase but passes out from blood loss and is left for dead. A desperate Murakami arrives at the hospital to donate blood but is distraught when there is no word from the doctors if Satō will survive. The following morning, Namiki has a change of heart and informs Murakami that she had an appointment with Yusa at a train station nearby. Murakami races to the train station and confronts a man based on his age, muddy clothes, and left-handedness, three tips he has collected over the past few days. Yusa is flustered by the unexpected confrontation and tries to bolt from the train station. Murakami pursues him into a forest and is shot in the arm, but Yusa wastes his last two remaining bullets. Murakami, in spite of his injury, still manages to wrestle Yusa down, handcuff him, and take him into custody. Days later back at the hospital, Satō has recovered and congratulates Murakami on receiving his first citation. Murakami briefly sympathizes with Yusa's situation, until Satō tells him to forget about it and to get ready for the cases that he will need to solve in the future.
Kurosawa mentioned in several interviews that his script was inspired by Jules Dassin’s The Naked City and the works of Georges Simenon. Despite being one of Akira Kurosawa's most critically renowned postwar films, Stray Dog was not always held in such high regard by the director himself. Kurosawa initially said that he thought little of the film, calling it "too technical" and also remarking that it contains "all that technique and not one real thought in it." His attitude had changed by 1982, when he wrote in his autobiography that "no shooting ever went as smoothly," and that "the excellent pace of the shooting and the good feeling of the crew can be sensed in the finished film."