Because it took a long time before the secret to silk was discovered. Wouldn’t something like gunpowder also be kept super quiet?
u/wotan_weevil answered a similar question here.
The basic "recipe" for gunpowder was the discovery, quite early on, that the white powder that sometimes formed on top of dung heaps could dissolve in water, and if cloth or paper was soaked in it and allowed to dry, it would make them burn almost instantly. Sulphur, found naturally , was also known to burn. For quite a long time- perhaps from the mid-10th c., the Chinese were experimenting with recipes, creating different pyrotechnical weapons, and by the mid 13th c. they had something that could be used in cannon. But figuring out how to make an actual consistent reliable gunpowder required removing sodium nitrate, calcium nitrate and salt from that white powder, leaving potassium nitrate- all without knowledge of chemistry. That would be worked out in Europe, but not until the mid 15th c. : about two hundred years later.