Firearms were present in Japan beginning in the 13th century, but saw little adoption. In 1543, the Portuguese introduced matchlock firearms, a much more impressive weapon, and Japan embraced them. They began manufacturing them in great numbers, researching firearms technology, and fielding armies equipped with firearms, which they used to great effect. In 1592 a Japanese force invaded Korea and rapidly captured Seoul, in large part due to the presence of an estimated 40k gunners in the force. It's estimated Japan may have led the world during this period in firearm production, and surviving written records suggest they saw firearms very positively.
...then, they stopped. There's an excellent book about it called "Giving Up The Gun" (https://www.amazon.com/Giving-Up-Gun-Reversion-1543-1879/dp/...) There's no super clear explanation; the answer mostly seems to be a vague hand-wavy nod towards "cultural reasons".
But, obviously, those cultural reasons didn't seem to apply prior to the Edo period, when Japan went all-in on firearms, arguably more so than any European country. Odd.
Some historians partially credit the victories by noted Admiral Yi Sun-sin to both use of local terrain and waterway lore and the asymmetric fielding of battlefield weaponry. There's a recent movie (The Admiral:Roaring Currents) retelling of the battle that, despite lots of historical liberties and national rah-rah bits, has some interesting visuals on the different dispositions of the opposing fleets.
The rest of the invasion seemed to not go as well where the better trained and more mobile Japanese army had control of much of the peninsula off and on.
> The Sengoku period (戦国時代 Sengoku Jidai, "Age of Warring States"; c. 1467 – c. 1603) is a period in Japanese history marked by social upheaval, political intrigue and near-constant military conflict. Japanese historians named it after the otherwise unrelated Warring States period in China. It was initiated by the Ōnin War, which collapsed the Japanese feudal system under the Ashikaga shogunate, and came to an end when the system was re-established under the Tokugawa shogunate by Tokugawa Ieyasu.
So, after the period of war ended and the Tokugawa Shogunate was established, the "Bakufu" clearly did not want millions of unemployed soldiers hanging around with guns. (I heard even the invasion on Korea was conceived as a means of keeping soldiers and lesser feudal lords busy, though I'm not sure how widely it is believed.)
And yet it still raises questions. It happened very suddenly as these things go (over a few years or decades, rather than centuries), and seems to have been accompanied by a deep, long-lasting cultural shift. Even after Japanese isolation ended in the mid 19th century, there didn't seem to be any real reversion (hence, indirectly, the originally linked article). If the establishment of the Tokugawa Shogunate was enough to make Japan give up the gun, why was it's collapse not enough to make Japan re-embrace it? If the answer is "unique Japanese culture", why was it not present at the start of the Sengoku period? It's not like the Sengoku period was just way more violent than the 1850-1950 period.
Anyhow, the book I linked (which I last read over 10 years ago, so I'm a bit fuzzy on some of the details) goes into a lot more detail, digging through historical records and evaluating most of the obvious theories. I highly recommend it!
I'd imagine during that time in Japan cultural reasons was a big enough reason. Edo period was characterized by isolationism. It was trade, religion (Christian converts were heavily persecuted at that time) and social structures were become more rigid https://en.wikipedia.org/wiki/Edo_society. There was finally the travel restriction https://en.wikipedia.org/wiki/Sakoku_Edict_of_1635. Perhaps guns were seen as something foreign they went away with all the other "foreign" things.