Because when a bullet is fired from a gun, the force sending the bullet forward (action) is equal to the force sending the gun backward (reaction).
But the mass of the gun is more than the mass of a bullet, so it moves only a little distance backwards and gives a backward jerk on the shoulder of the gunman.
It is given by relation : V ‘= -mV /M where M = mass of gun , m= mass of bullet , V’= recoil velocity of gun ,V = velocity of bullet.
Negative sign shows that gun recoil in opposite direction