It is illegal to provide a handgun to anyone under the age of 21. That includes gifts.
The person breaking the law would be the provider, your mother, not the recipient, you.
Your grandmother can likely own a gun. Where she keeps it in the house where you both live is her business. However, if you are caught with it outside the house, the cops will ask where you got it, and someone else, other than you, will likely be charged with a crime.
It is bad law, but it is the way things are.