This is Eva (2011).
From a review:
“Eva” is a modestly chilling if predictable Spanish science fiction film about “emo” robots. A 2011 vehicle for poly-lingual leading man Daniel Bruhl (“Rush”), it’s obsessed with that one great robotic concern in sci-i — the ineffable extra “something” that makes us human.
This is a Spanish-language film set in a near-future version of a town in Spain, overlooked by snowy mountains.
Ten years prior to the events of the film, the protagonist, Alex, along with his then-girlfriend, Lana, and his brother, David, were working on the creation of the 'SI-9,' a child-like robot intended to be the first "free" robot (apparently a reference to free will). For unexplained reasons, Alex, abandoned this project and emigrated to Australia, leaving Lana and David behind.
Ten years later, Alex returns to the town and is asked to finish the SI-9 project by his old mentor, Julia, a professor at the town's university. The SI-9's body is near-complete, resembling a small human boy; Julia just needs Alex to develop its emotional intelligence software. For this, he'll need to pick a real-life human subject to model it on. Julia shows Alex footage of various boys, but he finds them uninteresting.
He subsequently meets, Eva, the young daughter of David and Lana, who're now married to one another. Alex is fascinated by Eva's quirky personality, and begins basing the SI-9's programming on her, with her knowledge and consent, but without that of her parents. He has a child-sized humanoid robot in his workshop at home, and tests the programming out on that.
The programming involves him moving holographic shapes resembling glassy structures around in midair. He then pulls those shapes into a small sphere, and sends it into the head of the robot, which comes to life and begins moving around somewhat like a human child. It doesn't yet speak, and doesn't look human, with no skin or hair; just orange and white metal plating.
The next time Alex sees Julia, he proposes that they make the SI-9 a girl rather than a boy, arguing that boys are clumsy and boring, while girls are sweeter and more sensitive. Julia rejects this proposal, though, stating that girls are also more jealous and twisted, and that she knows all this because she was one once.
Alex continues to work on the robot he keeps at home, which can now speak, but the robot takes offense when he chuckles at its behaviour, and despite his attempts to calm it down, its anger escalates until it throws a chisel at a wooden beam just beside his head. Alex then issues a verbal command -- "What do see you see when you close your eyes?" -- which instantly shuts the robot down.
It was established earlier in the film that this is a "sacred" command which should only be used in extreme circumstances, as it destroys a robot's "emotional memory" -- its "soul" -- and that, while a robot can be restarted afterwards, it'll never be the same again. As such, Alex has now lost all the progress he'd made on this robot since his return.
Alex is subsequently visited in his home by Lana, who tells him that Eva is the finished version of the SI-9 robot they'd worked on together ten years earlier. Eva overhears this, and apparently unaware of the fact that she was a robot beforehand, runs off towards the mountains. Lana chases after her, but tells Alex to stay behind, as she wants to explain things to Eva alone.
Lana catches up to Eva, who's now lying face down in the snow, partway up a mountain. Lana slices off a section of the skin on Eva's back, drawing blood and exposing a metal hatch, which she opens to reactivate Eva. Eva wakes up, but when she notices the blood on her back, she begins acting out again. Lana tries to calm her down, but Eva shoves her and Lana slips and falls off a cliff edge to her death.
In the aftermath of this, Alex learns from Julia that Lana finished the SI-9 project after he left, but that Eva failed to pass the safety control, when tested. Lana wanted to keep her as a daughter, though, and Julia allowed it; a decision she now regrets. Julia insists that Eva must be destroyed, and intends to do it herself, but Alex persuades her to let him do it.
Alex spends one last day with Eva, before taking her home to bed. She initially thinks he's going to fix her, but realises he's actually going to shut her down, and, apparently accepting this, embraces him with tears in her eyes. He then issues the command -- "What do see you see when you close your eyes?" -- causing her to shut down, and he lays her head down gently on the pillow.
It's never stated in the film that making a robot girl is actually illegal. The only time illegality is mentioned is when Alex notes that his robotic, pet cat, Gris, is a free robot, doing whatever it likes, and that this is an "illegal application."