Is this offensive?

I think it depends on how you show that though, you just have to make the dialogue believable and might have to explain it more thoroughly. They should go through traumatic but symbolic events that lead them to thinking that they are the wrong gender.