It can be just a matter of semantics. If you define being a man as having a penis, then if you have a penis, you're a man.
I don't understand how someone with a penis thinks they're a woman, since I don't know how it feels different to be a man or a woman, nor can anyone else. But if someone wants to be a woman despite having a penis, what's the harm in adjusting the definition if it makes them happy?
My question is, did they think grandma identified as a man, so they put her in the male jail, or did they think she had a penis?