After the monsters reached the surface, Alphys began pulling all her time and effort into creating a artifical soul for Asriel. She found a way to create something similar to a soul but was wary of giving it to Flowey without testing it.
She created a robot that she designated Cyberdyne-10212, with a compartment for the artifical soul, intending to just activate it and then turn it off.
She activated the robot, and it immediately became clear it was no ordinary machine. It had emotions, and a mind. So the soul worked a little too well, and, while she still was intending to turn off Cyber, his soul made him too determined not to be shut down for that to happen.