Since time immemorial, Man has always sought to kill from a distance, whether for hunting or for warfare. Studies of our ancestors from the period of Neanderthals and Cro-magnons have shown that they had knowledge of throwing spears, atlatls, slings and bow/arrows. Even monkeys have been known to assail people by throwing sticks, fruits, dung etc.
It is surprising then that in some early societies, weapons that kill at a distance (e.g. bows and arrows, slings etc.) were not considered weapons of the warrior. The Macedonians under Alexander the Great fought in phalanxes of foot soldiers and the Roman legions used the short sword and shield effectively. Ancient vikings preferred the axe and the mace for war, even though they used bows and arrows for hunting regularly.
On the other hand, in some other parts of the world, the bow and arrow were considered legitimate to use in war. The Indian epics, the Ramayana and the Mahabharata, both mention the deeds and exploits of several legendary archers. Native American history is also full of stories of warriors using bows and arrows.
The invention of gunpowder in China happened around 800 AD or so. Deposits of saltpeter, which is one of the components of gunpowder, have been known to occur naturally in parts of India and China. The Chinese were certainly aware of the use of saltpeter for medicinal purposes and it is theorized that around 800 AD or so, some unknown alchemist had managed to combine sulphur, saltpeter, petrochemicals and honey, to produce a substance that burned violently. The Chinese were very quick to use gunpowder to wage war. Initially, gunpowder was used to produce rockets, bombs, flamethrowers etc., but around 1100 AD or so, it started to be used to launch projectiles at the enemy and thus the primitive firearm was born. The knowledge of gunpowder and firearms spread from China to Europe via the Arabs, via Spain and Greece and then spread northwards. By 1267 AD, Roger Bacon had written his Opus Majus which contained a formula for manufacturing gunpowder. Firearms technology was introduced to India by Muslim invaders from central Asia and the technology rapidly spread southwards into other kingdoms in India
In England, gunpowder manufacture didn't seem to happen until the 14th century. Until then, even though gunpowder was being used in war, the ingredients to manufacture it were purchased from outside. Records show that royal presents from that period often included a barrel of gunpowder. According to extant records, the first industrial manufacture of gunpowder in England started in the reign of Queen Elizabeth I, when the first mills were opened in Kent and the right of manufacture was granted to a family by the name of Evelyn.