tl;dr: It might be rape, but it depends.
There is the concept of rape by deception, which might apply here. However, that concept is usually only applied under very narrow circumstances - not every act of deception in a relationship can be used to later claim rape by deception.
There was a related case in England in 2015, where the situation was reversed to your question: A woman pretended to be a man as a means having sex with another woman. She was sentenced to eight years in prison. BBC article: Woman who posed as man jailed for sex assaults. However, in that case the accused never claimed to be transgender, she just falsely claimed to be a man. In the case of a transgender person, some would claim that their "new" gender is the real gender, so a court might decide differently.
Wikipedia lists another case in Massachusetts, where a woman had sex with her boyfriend's brother because he claimed to be the boyfriend. In that case the brother was found not guilty, because in Massachusetts rape by definition has to involve force:
(b) Whoever has sexual intercourse or unnatural sexual intercourse
with a person and compels such person to submit by force and against
his will, or compels such person to submit by threat of bodily injury
[...]
Commonwealth of Massacusetts, General Laws, Section 22
In Germany, I could not find any similar cases. However, in the German criminal code, the definition of rape includes:
- der Täter ausnutzt, dass die Person nicht in der Lage ist, einen entgegenstehenden Willen zu bilden oder zu äußern,
[...]
- der Täter ein Überraschungsmoment ausnutzt,
English:
- the offender uses the fact that the person is unable to form or to express a contrary will
[...]
- the offender uses a moment of surprise
Strafgesetzbuch (StGB) -
§ 177 Sexueller Übergriff; sexuelle Nötigung; Vergewaltigung, translation mine
So, again, a court could decide that the use of a deception causes the victim to be "unable to form a contrary will". However, courts will have to decide each case individually.