Some games do use firearms rules, so this question comes up. Provided the character is aware they are being shot at, can this ability bat aside a bullet?
Yes, it is possible.
Here is a direct tweet by Jeremy Crawford:
In my home campaign, we have a monk, and there are firearms. Deflecting/catching bullets is high up there when it comes to badass.
The Deflect Missiles feature description says:
Starting at 3rd level, you can use your reaction to deflect or catch the missile when you are hit by a ranged weapon attack. When you do so, the damage you take from the attack is reduced by 1d 10 + your Dexterity modifier + your monk level. If you reduce the damage to 0, you can catch the missile if it is small enough for you to hold in one hand and you have at least one hand free.
While J. Crawford's tweet relates to a a potential house rule*, the description of the Deflect Missiles ability simply states a ranged weapon attack. This means that any ranged weapon attack, which a firearm most certainly falls under. It is considered a ranged martial weapon (DMG pg. 268).
The other requirement is for the projectile to be small enough for you to hold in one hand and that you have a free hand to catch it. A bullet is definitely small enough to hold in one hand.