Here's a nice little timeline of guns. I'm not sure if you are referring to cannons or pistols/rifles, the first guns that were handheld were invented in the 1350s.
Who actually invented the first 'firearm' is lost
to history. About 1300AD, the mention and use of what we would consider
a firearm is mentioned in both Italian and British history. 1388AD is
the first British mention of the word 'hand gun'.
The Chinese seem to have invented gun powder and in 904 a treastise by
Siui Tung mentioned the mixture commonly used as black powder in later
centuries.