If it's happening to both your safes then the problem is somethings rotting, probably a carpet lining or similar and that the problem is most likely mold.
Doesn't have to be really obvious or advanced to be smelly.
Masking the smell is the wrong way to go, need to stop it happening.
Probably doesn't require anything drastic like replacing linings or whatever, just stop the process. The easiest thing is to reduce the moisture that's required for rotting to happen.
Baking Soda has been mentioned, I am loath to put anything in a gun safe that is potentially corrosive.
What does work is silica gel and/or clay kitty litter.
Both these are available cheaply as cat litter, the silica gel is reusable, the clay is not.
Both will get rid of moisture and smell. The silica gel gets rid of moisture quicker but smell slowly, the clay the other way around which is why I use both initially.
I put big buckets of the stuff in my safe, not just a cup or two. never had a problem since doing that.