When did Hercules originate?

Hercules is no doubt a really old legend about a demi god that was born to the Greek god Zeus and his wife, Hera. Disney made a movie about him, though, like Aladdin is to Arabian Nights, isn't quite right, but it gets the gist of the legend. At the end, he allegedly becomes a full fledged god when he risks his life for his love, Meg/Megara, when she is thrown into the green whirlpool of the dead, out of which Herc comes alive and glowing, like a god.