Two films on the American Film Institute's list of top 100 movies ever made have something in common. The first is "Some Like It Hot" (1959), where Jack Lemmon and Tony Curtis masquerade as members of an all-woman jazz troupe to escape revenge-seeking mobsters.
The second is "Tootsie" (1982), where Dustin Hoffman presents as a woman to get a job as a soap opera character, and enjoys success he lacked as a man.
The movie trope of people, predominantly men, crossing gender in order to evade some negative situation, is a long-established comedic concept.
After the success of the two films above — as well as the late Robin Williams vehicle, "Mrs. Doubtfire" (1993) — the silver screen filled with comparable movies.