Danae was sent to the underground cell with her son for king Acrisius's "safety" because of his knowledge that his future grandson was going to kill him.
we're getting married!!
when the king realized that his grandson's (Perseus) father was Zeus, he took Danae and Perseus, put them in a box and yeeted them into the ocean.
then a fisherman named Dictys, found the box and brought them to his wife where they raised them as their children until Polydectes (the ruler fell in love with Danae.
Polydectes loved Danae but didn't want Perseus so he announced that him and Danae were getting married but in reality it was a plan to get Perseus killed. earlier Polydectes mentioned that he wanted the head on one of the gorgons (medusa) so Perseus though "imma go snatcher her head for a wedding present".
Perseus set out on the adventure later to find Hermes in front of him telling him how to find out where to go in order to find medusa's lair, he points in the direction of the three witches.
once he finally arrived to the three witch's perseus took the eye in which they use to see in the future and said he was going to destroy it if they didnt tell him how to find the nymphs, they told him the exact directions.