Gunpowder is believed to have been invented in China and while its military applications weren't utilized for quite some time (or at least practical military applications).
By the time it was obvious others such as the Muslims and Europeans were starting to use them that way, you'd assume China would have had the infrastructure to dwarf the production capacity of any other?
Well as best as I can tell you can blame the Mongols then the Ming Dynasty for the latter but the former is false.
The first confirmed is in the 9th century, though it could have gone been as early as the 2nd, and the first confirmed practical military applications happened in the 10th century. It is worth keeping in mind this 'gunpowder' wasn't as we would know it since by the 11th century we know the formula used contained too little saltpetre to be explosive. The war between the Song and Jin dynasties beginning in 1125 contain the first through descriptions of the use of gunpowder in warfare but while the formula used had clearly improved significantly by this point it still had quite a ways to go to reach what we think of when gunpowder is mentioned. Fire lances(the predecessor of firearms) came into widespread use not long after that.
Towards the late 12th century is when true bombs and the first confirmed firearms were created though the latter wasn't of much use. Bombs saw effective and decisive use in warfare by the Jin in the early 13th century against the Song and by their final hour fighting Mongols in the 1230s the bombs they used in mass were capable of being heard even fifty kilometres away and killed everyone within ten meters and a new advance of the fire lance called the flying fire lance that was also pretty impressive.The following wars between the Mongols and the Song until the latter fell in 1279 saw even greater use of both and for the Song gunpowder was central to the war effort but the Mongols also made heavy use of it. Worth keeping in mind is that the Mongols committed more against the Song than they did to take the Middle East, Central Asia and the Rus plus had massive losses.
It is somewhat weird then that following the massive powerful role of gunpowder in warfare that the Mongols don't seem to have actually used it much outside China but, despite a few historians disagreeing, it is clear that the centuries of continuous refinement and inventions in China suddenly were available for many nations in conflict and thus not only kept that pace of development but an interconnected area far bigger and diverse than China meant it only sped up. At the same time most of the infrastructure of
everything broken, the people involved in the creation process largely taken away by the Mongols and an apparent disinterest combined to make the widespread use go into decline. The Ming Dynasty(1368-1644) early on still had the edge in the actual capabilities and varieties of gunpowder weapons but the use, infrastructure and need simply wasn't there thus it eventually just stopped.