The total momentum is unchanged according to the law of conservation of momentum. When the gun is fired, the bullet gains a high velocity forward (positive velocity), and that velocity multiplied by its mass is the momentum the bullet gains. Therefore, the gun must gain a momentum backwards to cancel out that momentum forward, so the gun recoils back with a negative velocity.