Everyone loves Freud, or at least they pretend to. The man himself comes and goes in popularity but many of his ideas have maintained a presence over the years. In horror specifically he has been a favorite reference point among film writers and academics who can turn to his ideas as a way of conceptualizing character motivation in a broader cultural sense detached from the confines of the film itself -- Freud's most popular theory as it relates to horror is "the return of the repressed." To oversimplify the idea, it states that subconscious desires/thoughts/etc. (the id) are suppressed in everyday life unconsciously (the ego) as a way of regulating one's presence in an acceptable manner in civilized society (the superego), but eventually these ideas find a way to manifest themselves in a person's personality through unconscious actions, tics, or behaviors. This was theorized in part to explain neurotic behavior, which has been a hallmark of the horror film.
While I'm not exactly sure Freud would have expected his concepts to be used to explain cheaply-produced mass entertainment, one of the most interesting examples of his "return of the repressed" actually comes from an unlikely source: the slasher film. I'm not here to argue the subgenre itself is an example but rather a certain subset of films within the subgenre grapple with the idea as it relates to gender identity in modern society.
A good place to start here would probably be Psycho (1960), Alfred Hitchcock's "psychological thriller" about a lonely motel clerk who assumes the identity of his dead mother to facilitate his murders; although, William Castle's Homicidal (1961) also contains a last minute shock that appropriates and goes further with Psycho's confusion over normative gender states. Both utilize Freud's concept to create killers that exist in a world that is outwardly hostile to them, either on an individual level (Norman's relationship with his mother) or on a societal level (Emily's father's desire for a boy), but neither is wholly repulsed by them. More than any film then or today, Psycho was representative of Freud's sexual kinks -- a psychiatrist explains that Norman first kills because he sees a sexual rival in his mother's new lover, playing off Freud's theorizing of an "Oedipus Complex" innate in men wherein the first woman they're sexually attracted to is their mother and they seek to eliminate all competition for her, which is usually represented by the father. Additionally, Norman developing a split personality is indicative of the repression he experiences from her murder -- he needs someone to guide him, so he creates a second personality to do just that. He doesn't necessarily envision himself as a woman, but he's been ruled by one for so long that he must become one to function properly.
In a much broader application of Freud's idea, Homicidal flips its use from a born-male Norman transforming into a woman onto a born-female Emily transforming into a man. The difference here is cultural, though. Norman creates the second identity as a mechanism for coping, but Emily doesn't have that choice. She's forced to become a man from birth due to her father's irrational need to have a son, a need that was (and still very much is) reflected in American culture, which places a higher value on male traits and attributes. Emily being revealed as the alternate identity at the end of the film is also a twist on the Psycho convention; we learn this character we've been following isn't real, even though biologically she may be. The unreality this presupposes where neither Emily nor Warren are technically correct is much more ambitious than Psycho, which neatly wraps up its killer's neuroses in some quick psychoanalysis. Homicidal unintentionally opens a door that would be explored further by other films.
Following the success of these two movies a number of other films trickled out over the next few decades playing on the idea of gender identity. Unfairly labeled "Psycho rip-offs," films like Name of the Game is Kill (1968), Dressed to Kill (1980), Sleepaway Camp (1983), and Cherry Falls (2000) all operate within, or predate, the slasher tradition, and all rely on last minute reveals flipping the identity of the killer's gender or perception of his/her identity. What's interesting is when viewed compared against another example, The Texas Chainsaw Massacre (1974), all of these films speak on an undercurrent in horror films, that of a perceived misogyny, to transmute a criticism by society of the genre into the genre itself criticizing society.
In TCM, Leatherface takes on the identities of many of his victims by literally stepping into their skin, but tellingly, he frequently chooses to wear his female victims at the expense of their male counterparts. This is definitely a subtle reference to real-life serial killer Ed Gein, but it also speaks on the nature of identity in the Sawyer house. In the first two Texas Chainsaw Massacres, there are no women living in the household; Leatherface wears his female victims as a role of transference whereby he takes on "female" characteristics to create the illusion of a nuclear family. In the first film, he wears an apron and carries a cooking utensil. Actor Gunnar Hansen who portrayed Leatherface even stated the intention as such in an interview with Dutch magazine Trauma:
The reason he wore a mask, according to Tobe and Kim, was that the mask really determined his personality. Who he wanted to be that day determined what mask he put on. So when Drayton comes home with Sally, Leatherface is wearing the 'Old Lady Mask' and he's wearing an apron and carrying a wooden spoon, he wants to be domestic, helpful in the kitchen. At dinner he wears a different face, the 'Pretty Woman,' which has makeup."
Throughout the series he would take on and lose more characteristics we typically associate as being female. Despite this, the protagonist of the film is always a woman, and Leatherface even occasionally grapples with his own possible attraction to her, as in his relationship with Slim in Texas Chainsaw Massacre 2 (1986). This plays on the dual nature of his reality, where he doesn't necessarily have a dominant gender identity; at home he may take on the role of a woman, but in public he reverts back to his more masculine identity.
This is the heart of where the slasher subgenre turns into a self-reflexive criticism of the gendered violence we associate with it. Taken from a purely character perspective, these individuals are typically men who choose or are forced to become women (with the exception of Homicidal). The violence they mete out is disproportionately directed at women because it's the only mode through which these men know how to express their outrage at society. They want to become women, or something else entirely, but language systematically attacks female attributes and characteristics; women are the fairer sex, you shouldn't throw like a girl, no guy wants to act like a pussy, and so on. This imposes an inner-conflict on these characters and they suppress their desires to live as they feel they truly are, only for those desires to manifest in a destructive manner directed at individuals who are able to live freely, or at least more freely than the characters in question. The act of killing becomes a way to reassert the masculine portion of their identity even as they may outwardly embrace a perceived view of femininity in the way they dress or act. This has the effect of placing these characters in a state of limbo, not entirely male or female, and then forces them to associate with the male side of their identity as a way of fitting in, so the violence can be seen a form of self-expression directed back at society. The unfortunate part of this, which becomes the criticism of the subgenre directed at society, is that the violence in the film is directed at a group that continually bears the brunt of society's burden. The misogyny of the slasher film is important because it acts as a mirror reflecting back the kind of hatred and cruelty we unconsciously perpetrate on a daily basis. So, not only is the film dealing in a return of repressed anxieties, but it's also commenting on one: even as we pretend we're more inclusive and equal, we continue to find ways to attack and denigrate.