Explanation: Contrary to popular belief, the katana is not the traditional weapon of the warrior class of Japan. Bushi were traditionally more associated with the bow and the spear, and typically in mounted combat at that.
In the period of the Sengoku Jidai, an era of civil war in the 16th century AD, some strange Euro fellows brought a new technology to Japan - the firearm. Rather than disdaining this new weapon as dishonorable or any other such nonsense, the samurai class eagerly embraced this new weapon, both as a method of arming peasants and for gunning down enemies themselves. The famous duelist Miyamoto Musashi even regarded the gun as an unmatched weapon for the defense of castles.
The association of the samurai class with the katana is more an invention of the Edo Period of peace and isolation, around ~1600-1850 AD, wherein the only major task of samurai was reacting to meaningless slights and cutting people down on an impulse - for which a sword, as an easily carried sidearm and status symbol, was much handier than an actual weapon of war like a spear or a bow.
