The Chinese invented it
Gunpowder was the first chemical explosive ever invented. The Chinese created it in the 9th century, historians think. They were not even looking for an explosive. 'Scientists' were trying to come up with something that would make people live forever. Instead they invented something that would kill millions of people.
Nobody is really sure if gunpowder spread from China, or if other countries discovered it on their own. In the 11th century the Song dynasty government made it illegal to sell gunpowder to foreigners. Still, by the late 13th century, the Islamic world had discovered gunpowder.
The age of the gun
At first, European armies looked down on gunpowder. This was the age of the knights who said gunpowder was black magic. But by the 14th century, every European army was using guns or muskets - the earliest version of the rifle. Ming dynasty troops began using them around the same time.
By the 16th century, armies all over the world were using different forms of the musket. It still took handguns a long time to completely replace crossbows and long bows.