I was talking with a friend last night, and the topic of imperial Japan (WWII specifically) came up. My friend had mentioned that he’d heard that Americans had been trained to block strikes from katanas (perhaps with their guns?) but because of how they were forged they’d cut through the gun and still get the person. Is there any truth to this? And what were the swords specifically intended for? Was it some kind of traditional item, or a last resort, or something else entirely?
There's absolutely no way a sword will cut through a gun. Doesn't matter how sharp it is, striking a metal receiver in a wood stock will result in the sword either:
Swords were in use because Imperial Japan had only just modernized less than 100 years before the war. Japan spent 1633 until 1853 isolated from much foreign interaction, receiving their only European contact through a Dutch trading post in Nagasaki. They essentially spent 220 years at a 17th century technology level. The Meiji Restoration in 1868 ended this isolation and Japan began rapidly trying to catch up; they designed their first indigenous semi-automatic pistol about 60 years after they had been using matchlocks.
Japan continued to require its officers to carry a sword into the 20th century as a symbol of their rank and authority, leading to an industry mass producing what were once traditionally crafted weapons; originally they manufactured Western-style cavalry swords, but rising nationalism led to a switch to katanas. They would inevitably be taken into battle, where the often fanatic Japanese officers would charge enemy soldiers with them.
The actual quality of these swords varied greatly. Mass produced swords could be even better than traditional blades due to modern metallurgy, while others (especially toward the end of the war) were very cheap and just served as the bare minimum to count as a sword. Some officers even brought traditional blades into battle, passed down in their family for generations. But no, none of them could cut through a gun.