Muhammad was a bit like a circus entertainer picking up on fables and myths and elaborating on them to wow his audience.
His favourite source was the Bible and in particular the Old Testament - but he often got things a bit mixed up - or perhaps it was the sectarian milieu in Madina, far removed from the main centers of Judaism and Christianity that had the stories already jumbled up and Muhammad just picked up on them. Here's an example fro Suratul Baqara verses 67 - 73:
And remember Moses said to his people: "Allah commands that ye sacrifice a heifer." They said: "Makest thou a laughing-stock of us?" He said: "Allah save me from being an ignorant (fool)!"
They said: "Beseech on our behalf Thy Lord to make plain to us what (heifer) it is!" He said; "He says: The heifer should be neither too old nor too young, but of middling age. Now do what ye are commanded!"
They said: "Beseech on our behalf Thy Lord to make plain to us Her colour." He said: "He says: A fawn-coloured heifer, pure and rich in tone, the admiration of beholders!"
They said: "Beseech on our behalf Thy Lord to make plain to us what she is: To us are all heifers alike: We wish indeed for guidance, if Allah wills."
He said: "He says: A heifer not trained to till the soil or water the fields; sound and without blemish." They said: "Now hast thou brought the truth." Then they offered her in sacrifice, but not with good-will.
Remember ye slew a man and fell into a dispute among yourselves as to the crime: But Allah was to bring forth what ye did hide.
So We said: "Strike the (body) with a piece of the (heifer)." Thus Allah bringeth the dead to life and showeth you His Signs: Perchance ye may understand.Now have a look at this from the Old Testament - see a resemblance
Deuteronomy 21:1-9
If a man is found slain, lying in a field in the land the LORD your God is giving you to possess, and it is not known who killed him, your elders and judges shall go out and measure the distance from the body to the neighboring towns. Then the elders of the town nearest the body shall take a heifer that has never been worked and has never worn a yoke and lead her down to a valley that has not been plowed or planted and where there is a flowing stream. There in the valley they are to break the heifer's neck. The priests, the sons of Levi, shall step forward, for the LORD your God has chosen them to minister and to pronounce blessings in the name of the LORD and to decide all cases of dispute and assault. Then all the elders of the town nearest the body shall wash their hands over the heifer whose neck was broken in the valley,and they shall declare: "Our hands did not shed this blood, nor did our eyes see it done. Accept this atonement for your people Israel, whom you have redeemed, O LORD, and do not hold your people guilty of the blood of an innocent man." And the bloodshed will be atoned for. So you will purge from yourselves the guilt of shedding innocent blood, since you have done what is right in the eyes of the LORD.
btw I hope modern police forces take note - if you want to solve a murder, you need to kill a cow and slap the dead body with a bit of it.