First of all let me clear your misconception.
Apples fall because of gravity, it doesn't mean that apples are falling that's why we say its gravity. Think of a situation where you are on a planet with no gravity. There is apple floating in the environment due to lack of gravity. Now if you charge the apple ( by rubbing or some other means )and then start a electric field in such a way that it will push or pull the apple towards the ground. You'll see that apple is falling towards the gorund but is it because of gravity? NO. Its because of force due to electric field.
Now lets come to your question,
When a gun is fired, there is some explosive material which is ignited. The blast of that explosive generates energy to fire the bullet from gun. The same energy from the blast causes the recoil because the energy is not generated in one direction, it has its effect in every direction but most of the momentum is felt in the direction opposite to the direction of bullet because of conservation of momentum.