‘Did you program her to flirt with me?” Domhnall Gleeson’s character asks robot inventor Oscar Isaac in Ex Machina. To which the scientific answer would be: “Well, duh!” The “her” in question is Ava, a shapely, state-of-the-art android, half-transparent plastic, half-Alicia Vikander. Isaac wants Gleeson to give his latest invention the Turing test – to determine whether or not she is indistinguishable from a human. Thanks to Ava’s beguiling, seductive intelligence, the interviews take on a certain Basic Instinct aspect, her suggestive retorts rebounding around the glass walls of her cell. Gleeson’s not-so-scientific verdict: “I feel that she’s fucking amazing, dude!”

Watch a video review Guardian

Ex Machina is a smart, elegant thriller posing some juicy questions about artificial intelligence, consciousness and gender. It is also a movie where the guys keep their clothes on and the “women” don’t. Looking back over movie history, it is difficult to find a female robot/android/cyborg who hasn’t been created (by men, of course) in the form of an attractive young woman – and therefore played by one. This often enables the movie to raise pertinent points about consciousness and technology while also giving male viewers an eyeful of female flesh. The non-scientific term for this is “having your cake and eating it”.

Being literally objectified women, female robots have traditionally been vehicles for the worst male tendencies. Invariably, inventors’ ideas of the “perfect” woman translate into one who is unquestioningly subservient and/or sexually obliging. A Stepford wife, to cite the best-known example. Or, as Blade Runner dismissively labels one female replicant, a “basic pleasure model”. The trashier end of sci-fi movies is littered with these basic pleasure models: they cater to wealthy males’ urges in Westworld, they’re traded like used cars in Cherry 2000, they go-go dance in gold bikinis and prey on wealthy men in Dr Goldfoot and the Bikini Machine, which inspired Austin Powers’ fembots, with their weaponised breasts. They’re all programmed to flirt.

But once made flesh, these fantasies have a nasty habit of biting their male creators on the … well, on the penis in the case of Eve of Destruction, a trashy sub-Terminator sci-fi in which a malfunctioning android, played by Renée Soutendijk, goes rogue. Sporting a red leather jacket, a black miniskirt and a big machine gun, this Eve sticks it to an assortment of sexist scumbags, before activating the nuclear device hidden in her vagina (haven’t all women got one?). Most movies are slightly more nuanced, but female robots rarely stick to their programs, leading to chaos and destruction.

It was all there right from the start, in what must be the great-grandma of female-robot movies: Fritz Lang’s Metropolis. The robot anti-heroine of the piece is a complex construction: mad scientist Rotwang has modelled her on his lost love, Hel, who also happens to be the mother of the movie’s hero, Freder. When Rotwang brings the robot to life, she takes on the likeness of the saintly Maria, Freder’s love interest (the real and robot Marias are played by Brigitte Helm). No wonder Freder is driven to his bed when he finds this false Maria (whom he takes to be the real Maria) in the arms of his own father. Sigmund Freud would probably have done the same.

And of course, Metropolis’s robot is irresistibly seductive, with her sashaying hips and art deco fetish-gear bodywork. Robot Maria is deployed as an erotic dancer at Rotwang’s club, where her burlesque gyrations drive the ogling menfolk into a frenzy. Posing as the real Maria, she ultimately foments a workers’ uprising which threatens to bring down civilisation. Like so many of her descendants, Metropolis’s Maria embodies all the old saws that have defined women since the year dot: she’s the whore of Babylon, the temptress Eve, Pandora and her box, Pygmalion’s Galatea, the femme fatale.

“Our machines are projections of us. They’re dreams or metaphors for our own anxieties,” says Sophie Mayer, a lecturer in film studies at Queen Mary University of London, who has written on robotics and gender in cinema. “Metropolis was made at the height of Freud and women’s suffrage and the communist struggle around male labour.” Often the anxiety in question in these movies is female empowerment, says Mayer. “Cyborgs have powers and freedoms that human females are rarely allowed to have. They misunderstand the rules about gender behaviour. They can be more sexually aggressive.” Ultimately, these empowered women must be punished. Metropolis’s robot Maria is burnt at the stake like a witch, for example. “The resolution always assures us the status quo is going to be preserved.”

Ex Machina at least moves the debate on somewhat. For one thing, it asks the pertinent question of why a robot should have sexuality at all. “Is sexuality a component of consciousness? It’s tricky,” says Alex Garland, Ex Machina’s writer and director. “Embodiment – having a body – seems to be imperative to consciousness, and we don’t have an example of something that has a consciousness that doesn’t also have a sexual component. If you have created a consciousness you would want it to have the capacity for pleasurable relationships, so it doesn’t seem unreasonable that a machine have a sexual component. We wouldn’t demand it be removed from a human, so why a machine?”

Garland points out that Ava’s femininity is only external. “People instinctively think there is a difference between male and female brains, but in many ways it doesn’t stack up when you look at it hard,” he says. Her seductiveness make sense in the context of the story, he argues. “If you’re going to use a heterosexual male to test this consciousness, you would test it with something it could relate to. We have fetishised young women as objects of seduction, so in that respect, Ava is the ideal missile to fire.”

Ex Machina could be seen as a warning against conflating feminine and technological seductiveness, but it is hard to find a female robot sci-fi that doesn’t do it. Even in Pixar’s apparently innocuous Wall-E, the non-humanoid “female” robot (of course, she’s called Eve) is smooth, rounded and pristine white – like a new Apple product. Wall-E, by contrast, is a rough, dirty, blue-collar worker guy. You could argue that these are robots, and therefore Eve is not “female” at all, but let’s not forget that Wall-E literally puts his seed in her belly, thus creating new life on earth.

Even without a body to ogle at, men apparently find it difficult to resist female-based technology. In Spike Jonze’s Her, for example, Joaquin Phoenix falls in love with his new operating system even though she is just a voice. Admittedly it’s the velvety, husky voice of Scarlett Johansson. Once she is given a female identity, “Samantha” basically becomes Phoenix’s Manic Pixie Dream App. She is supportive, lively, curious, completely available. She is the perfect girlfriend, at least until he finds out she’s been seeing other people – about 8,000 of them. But Her takes the radical step of letting Samantha go off to pursue her own goals in some virtual AI commune, leaving us human losers behind. She sets herself free, and she manages to do it without biting anyone’s penis off.

It almost goes without saying, but men don’t come off particularly well in these movies either, human or artificial. Womanly automata tend to be built by unhinged loners who can’t get laid – not a profile the real-world scientific community would endorse, but both the male characters in Ex Machina conform to it.

And “male” robots and AIs are usually just as hamstrung by their gender roles. They’re either militarised and violent (Terminator 1, Transformers, Robocop, Tron’s MCP, Yul Bryner in Westworld), surrogate father figures (Terminator 2, The Iron Giant) or buddies (Star Wars, Silent Running, Moon, Interstellar – note how those next-gen droids formed an easy, bantery bond with Matthew McConaughey but barely spoke to Anne Hathaway).

Maybe that’s the real problem: robot movies are supposedly futuristic, yet most of them peddle antiquated myths and gender stereotypes. It’s not as though nobody has imagined future scenarios that go beyond all this. Feminist academic Donna Haraway’s influential 1985 essay A Cyborg Manifesto suggests that boundaries between male/female, human/machine or even human/animal are no longer relevant. There is no “natural”. We are all cyborgs, in the sense that we are all “theorised and fabricated hybrids of machine and organism”. Our bodies integrate with technology all the time: medicine, artificial limbs and organs, vehicles, sex toys, communications technology, especially the internet. Biological models no longer apply. “The cyborg does not dream of community on the model of the organic family, this time without the Oedipal project,” Haraway wrote. “The cyborg would not recognize the Garden of Eden; it is not made of mud and cannot dream of returning to dust.”

Looking through this cyberfeminist prism, there are non-mainstream movies out there on women’s relationship to technology, made by women. Mayer cites cult 1990s sci-fi Tank Girl, the post-apocalyptic tale of a Riot Grrrl and her phallic machine socking it to patriarchal baddies – often in the crotch. Or current boundary-pushing indies such as Shonali Bose’s Margarita, with A Straw, the story of a bisexual wheelchair-user with cerebral palsy, or the multimedia works of Taiwanese artist Shu Lea Cheang. You could also include Conceiving Ada and Teknolust, two experimental films starring Tilda Swinton (a posthuman icon if ever there was one). Or, outside of cinema, musicians such as Janelle Monáe, the latest in a long line of performers to appropriate Metropolis’s Maria. An Afro-futurist cyborg narrative runs through Monae’s first two albums Metropolis: Suite I (The Chase) and The ArchAndroid, in which she claims to be an android sent back in time to heal society’s rifts.

Mainstream sci-fi cinema rarely ventures into these outer territories, but there is always hope – increasingly in the form of Scarlett Johansson. She’s become something of a specialist in inhuman/posthuman roles. As well as Her, she has recently been a man-hunting alien in Under the Skin and a self-programming superwoman in Luc Besson’s Lucy. Her next movie is a live-action remake of the Japanese anime Ghost in the Shell, in which she will play a cyborg cop on the hunt for a rogue computer programme with no physical body. It could be radical.

Robot masculinity could also be evolving. Neill (District 9) Blomkamp’s forthcoming Chappie centres on an empathetic “childlike” robot who doesn’t want to fight. Before that, we’ve got Disney’s Big Hero 6, a family animation centred on a very likeble robot named Baymax. He is a medical robot, programmed to care for the sick and designed to look unthreatening. He is inflatable, soft and squishy. He hugs people. Admittedly, he is turned into a kick-ass warrior-bot by his owner, but you can’t have everything.

But if we’re looking for a robot who really transcends gender stereotypes, it could be the most famous one of all: Star Wars’ C-3PO. He is basically the first transgender robot. According to his creator, artist Ralph McQuarrie, “George [Lucas] brought a photograph of the female robot from Metropolis and said he’d like Threepio to look like that, except to make him a boy.” Breasts and hips removed, this gender-realigned Maria is the perfect robo-companion. “He” is unthreateningly camp and non-violent, and a bit of a wuss, so he never upstages the male heroes. He is also unerringly polite and a great communicator, which makes him a hit with the ladies. And there is absolutely nothing sexy about him.

• Ex Machina is released in the UK on 23 January.

Guardian Film Club: Ex Machina screening and panel discussion, London, 20 January, £20, membership.theguardian.com