Akira Kurosawa told Toshirô Mifune that his character was like a wolf or a dog and told Tatsuya Nakadai that his character was like a snake. Inspired by this direction, Mifune came up with Sanjuro's trademark shoulder twitch, similar to the way a dog or wolf tries to get off fleas.
Akira Kurosawa asked his sound engineer Ichirô Minawa to come up with a sound effect to be used when a sword is cutting, and killing, someone. After testing out slicing a sword into beef and pork, he finally found the perfect sample--putting two wooden chopsticks inside a raw chicken, then hacking it with a sword.
Akira Kurosawa challenged his assistant directors to come up with an image for the film to let Sanjuro know he was entering a bad town. He shot down all of their ideas, since all of them had already been done. Kurosawa himself then came up with the idea of the dog carrying the human hand.
Masaru Sato was instructed by Akira Kurosawa to write "whatever you like" so long as it was not the usual period samurai film music so commonly used by all the major studios at the time. He ended up writing something that was inspired by one of his idols, Henry Mancini, whom he had the pleasure of meeting shortly after the film was released, where they discussed his "Yojimbo" soundtrack.
Sergio Leone was inspired by this film and made the famous "spaghetti western" A Fistful of Dollars (1964) with a similar plot. However, because Leone did not officially get permission to remake this film, which was copyrighted, Akira Kurosawa sued him.
In one scene the samurai shows incredible skill at knife-throwing by impaling a blowing leaf against a wooden floor. This was accomplished by running the shot backwards. In the frame before the knife hits the leaf, you can see a slit in the leaf the same size and at the exact point where the knife penetrates it a frame later.
Tatsuya Nakadai, who plays the flamboyant, pistol-waving Unosuke here, also plays the main villain role in the sequel, Sanjuro (1962).
Masaki Kobayashi pushed back the filming of The Human Condition III: A Soldier's Prayer (1961) so that Tatsuya Nakadai could do this film. He explained that he thought it would be good for him to play a totally different character for a while.
Yojimbo was an obvious inspiration for Sergio Leone's classic For a Fistful of Dollars (1964) although it was not credited as the source material for the film. Walter Hill however also remade Yojimbo years later as Last Man Standing (1996) starring Bruce Willis, and credited Kurosawa's film as the original source. All three films follow a very similar plot although each takes place in a far different setting and time in human history.
After Akira Kurosawa scolded Toshirô Mifune for arriving late to the set one morning, Mifune made it a point to be ready on set at 6:00 AM every day in full makeup and costume for the rest of the film's shooting schedule.
This was a deliberate attempt by Akira Kurosawa to revise the cinema's attitude towards onscreen violence. He wanted to show the damaging effect of violence, rather than the slightly anodyne way that it had usually been depicted before. (He would later come to regret this move, as it spawned a mass movement in international cinema that hasn't abated even today.)
The fact that the main villain sports a gun shows the slow creep of Westernization and pitches the film as roughly taking place in the 1860s. It was around about this time that the USA started forcing Japan to come out of its isolationist policy that had effectively kept the country stalled in a feudal, almost medieval society.
When asked his name, the samurai calls himself "Kuwabatake Sanjuro", which he seems to make up while looking at a mulberry field by the town. Thus, the character can be viewed as an early example of the "Man with No Name".
The film was so successful that Akira Kurosawa's next project - already in pre-production, and ultimately called _Sanjuro_ - had to be revised to accommodate Toshirô Mifune's title character.
Akira Kurosawa was heavily influenced by the American Western for this film, particularly High Noon (1952) and Shane (1953). He also admitted to being heavily influenced by the film noir The Glass Key (1942).