Yesterday, a (generally highly educated and intellectual) friend of mine repeated the claim that the Chinese invented gunpowder but only used it for entertainment purposes like fireworks (that is, not as weaponry), and that it wasn't until Europeans got ahold of it that it was used for war. At that moment I was dimly aware that the claim might be false, having heard something about that at some vague point in the past; so I checked on Wikipedia to find that, yes, the Chinese used gunpowder for weaponry almost immediately after inventing it, and for centuries before it made its way west.
I've been hearing this claim since I was a kid, but I would be unsurprised to find that historians knew this wasn't true even back when I was being taught it in elementary school. How did this myth start? Did historians always know it was bunk, or was there at some point a widespread belief among historians (or perhaps historians from Western cultures; I know historians are not a monolith) that the myth was true?
I can't really give you an answer as to the origin of the myth. It does not seem that it was until 1973 that Joseph Needham's ongoing project and publication series Science and Civilization in China documented firearms existed in China before Europe, by the 13th c. Why it took this long I will leave to someone else who is familiar with doing historical research with Chinese sources.
However, the story is a little complex, and so perhaps it was easy to jump to conclusions. The Chinese had nitrate explosives quite early, perhaps by 800 AD. The reasons for that may have included naturally-occuring nitrate /salt deposits. If cotton cloth was soaked in a bath made from these salts, and dried, it would burn almost instantly. It was a pretty straightforward process to go from that to fire weapons, and they did. But dismissing them as fireworks is , frankly, stupid. They were used as bombs, flaming projectiles, incendiaries...not just festive effects for mere celebrations.
However, although lots of different nitrate compounds will work to make fire weapons, something better, with purer potassium nitrate , is needed for a gun that's going to shoot consistently, that's going to be aimed. The earliest guns, whether cannon or hand cannon, weren't, really: they were pointed. If you look at early cannon like Dulle Griet, they didn't have carriages that allowed for fine adjustments and were pointed at pretty large things, like castle walls. Likewise, smaller guns were set on the ends of poles, and pointed towards big masses of soldiers. And the Chinese didn't really work out how to manufacture a good gunpowder that was consistent enough to make accuracy possible. The Europeans did that, in the 14th c. Why the Chinese didn't and the Europeans did gets us into hypotheticals, but Kenneth Chase has suggested that aimed artillery and aimed firearms were not that useful in the highly-mobile wars involving nomads like the Mongols on the plains of central Asia- it would have been hard to haul a cannon around, and there were few fixed, big targets available. On the other hand, the almost constant war in Europe during the 14th-15th c., was over a densely-settled area with lots of castles and fortresses. So, because it was practical for the Europeans to figure out how to make better gunpowder, they did, and the Chinese didn't bother. It's not a bad hypothesis.
Chase, K. (2008). Firearms: A Global History to 1700 (1st ed.). Cambridge University Press.