First, an anomaly that probably doesn’t fit the op’s criteria:
Hamlet (1921) – Asta Nielson plays the title role, but among many other interesting changes to the play, the part has been rewritten as a female. - Hamlet (1921) - IMDb
Few films top the gender complexities of Swordsman II (1992). Master Asia, who wants to rule China, has castrated himself to get supernatural power. As he transmogrifies into a woman, his girlfriend wonders why they haven’t slept together recently. The film’s hero (Jet Li) later “sleeps with” Asia before finding out the truth about him/her. Variously male or female, Asia is played by Brigitte Lin, an actress of glamorously androgynous looks.
I just finished reading a book on Val Lewton where the author discussed horror movies by different director/producers, and The Old Dark House was one. And I was going to come here and say I knew where your “name” came from. But I forgot. But, yeah, now I know!
Adam Sandler played brother and sister in that terrible film with Al Pacino a few years ago. I’ve forgotten the name and it doesn’t merit looking it up!
When filiming “LOTR:The Return of the King”, a casting call went out for extras with horseback riding expertise for the battle scenes. There were not enough suitable male respondents but there were a lot of women. A great many of the mounted warriors in the Battle of the Pelennor Fields were women in beards.
It occurs to me that Mrs. Doubtfire does, in fact, qualify for the OP’s criteria. No, not the movie: The fictitious TV show that the movie character ends up creating at the end.
Also the first actor/movie I thought of. I love the end-credits where there’s just a big left curly brace {
between Alec Guinness and all those characters he played.
Speaking of Tilda Swinton, in the MCU Doctor Strange movies she plays the “Ancient One”, who in the comics at least is a male character. I cannot figure out if the movie version is supposed to be female instead, though.
And speaking of Hamlet, if you count a play-within-a-movie, Kenneth Branagh’s 1995 In the Bleak Midwinter is about a (fictional) stage production of Hamlet. In the cast, the (real-life, well actually he’s deceased but you know what I mean) gay male actor John Sessions plays a gay male actor named Terry Du Bois who in the fictional production plays the straight-female role of Queen Gertrude. Whew, that was more complicated than I thought.
And OMG how could I forget filmed opera productions? There are boatloads of operas with female singers in the “travesti” roles where the character is male but the vocal range is soprano or mezzo-soprano. (Many such roles were originally written for male castrati/eunuchs but were taken over by female singers as the practice of mutilating boys to produce male sopranos fell out of favor.)
To complicate matters further, many of the male travesti characters are required by the opera plot to dress up as women at some point, so what’s being presented is a female singer playing a male character pretending to be a woman.
And if that’s not complicated enough, there are also opera travesti roles the other way around, where the character is female but the role is usually sung by a man.
Anyway, if filmed opera productions count for the OP’s criteria, then we got a million of 'em.