Gunpowder did not appear in Europe until the late 13th century. Gunpowder was initially invented in China around the early 9th century AC and spread first to the Middle East and later to Europe by trade routes. Some historians believe that gunpowder was independently invented in Europe, though it's not very likely.
Gunpowder eventually reached Europe. It played a very important role in warfare (see The Decline of the Medieval Castle). Due to the nature of gunpowder, it became increasingly popular for being easy to use, light and cheap. Before the 14th century, men had to be completely devoted to war, but this changed with the introduction of gunpowder when an unskilled arquebusier could kill a knight easily.
This brought some major changes to medieval life. Men no longer needed to train for years in order to be useful at battle - a simple peasant could be equipped with an arquebus and prove devastating against the traditional soldiers. At first gunpowder was mostly used to scare the enemy soldiers due to its ineffectiveness and only until later was it widely used as an effective way to kill.
Cannons began appearing in the west until the 14th century. The bombard was the most primitive form of cannon and consisted of a simple tube. It was especially effective against castles which, if besieged properly, could be successfully assaulted in a matter of weeks or even days.