Flowey is actually Asriel Dreemurr
http://vignette4.wikia.nocookie.net/undertale/images/f/fc/Dreemurr.png/revision/latest?cb=20151014093234 ,Toriel and Asgore (the king)'s son. He died and due to a failed experiment by Alphys, he was turned into a flower. This is why Alphys is insecure and doesnt like herself, she feels pressures from all the mistakes she's made, causing the existences of Flowey and the amalgamates.
What happened is that Alphys tried to ressurect monsters that "fell down" with determination, but it failed. Monsters, unlike humans, cannot handle determination and melted and fused together. Afraid, Alphys locked them up in her lab and never told anyone about them. Flowey, however, was not locked and he went on to try to become back to normal, but he lost his soul and as a result cannot feel love or emotions. He does destructive things as an attempt to try to feel anything at all, even hatred.