Firearms are first reported to be used in China in the mid-1200s as "fire lances"; no projectiles were shot and it fired lit gunpowder itself. As for armies using them as specifically firearms, Europe starting using "hand-cannons" in the 1300s, with the Arquebus beginning to go into wide use in the 1400s. The first person who used extensively musketmen was Matthias Corvinus of Hungary, whose armies' composition was one third musketmen: unusually high for its time (The Hussite wars of the 1400s).
A musket's use in armies was interesting to say the least; After an initial "fire" phase of combat there would generally be no time to reload, so the muskets were instead used as clubs by attacking with the stocks, or just dropped to be replaced by a sword. By the 1500s, the arquebus was a very popular weapon and was eventually the most-used ranged weapon in land combat.
Sources; my own knowledge, militaryheritage.com and G. Raszo's From Hunyadi to Rakocki: War and Society in Medieval Hungary