There are a lot of myths surrounding Darwin and his religious beliefs and declarations. I hope to clear some of that up here.
There are several versions of this myth that I've heard, here is an example:
Darwin said in his later years that he was "very foolish" and had "postulated a theory and they [his followers] turned it into a religion."
or most commonly:
On his death bed his called out to God for forgiveness for inventing the "theory" of evolution.
There's no evidence that he said either, or anything even close to it. The story originates from a woman named Elizabeth Hope who claimed in 1915 that she had visited Darwin while he was dying, claiming that he had recanted his theory of evolution and accepted Jesus Christ. His family strongly denied that she was even there, as his son Francis wrote in 1918:
"Lady Hope's account of my father's views on religion is quite untrue. I have publicly accused her of falsehood, but have not seen any reply. My father's agnostic point of view is given in my Life and Letters of Charles Darwin, Vol. I., pp. 304 - 317. You are at liberty to publish the above statement. Indeed, I shall be glad if you will do so."
Then in 1922 his daughter Henrietta stated:
"I was present at his deathbed, Lady Hope was not present during his last illness, or any illness. I believe he never even saw her, but in any case she had no influence over him in any department of thought or belief. He never recanted any of his scientific views, either then or earlier. We think the story of his conversion was fabricated in the U.S.A. ... ...The whole story has no foundation what-so-ever."
As the above shows[12][13][14][15], there's no proof what so ever that Darwin ever renounced his theory of evolution. Even if he had renounced it, it doesn't change the massive amounts of scientific evidence that show evolution is scientific fact.
Darwin was an atheist, either before or after the theory of evolution
Early in his life Darwin believed in the literal interpretation of the Bible, and even quoted the Bible while aboard the Beagle[16]. After returning from abroad he was critical of using the Bible as a historical account[16]. He continued to go to church until 1849 when he'd go for walks while his family still attended[17][18]. In 1879 he said that he was never an atheist or denied the existence of a god, but rather "an Agnostic would be the more correct description of my state of mind."[19] However, on other occasions - and more often - he referred to himself as a theist[16].
Darwin lost his faith in God, most specifically Christianity, after the death of his daughter Anne
There's no evidence to suggest this, however it might be worth noting that he had stopped attending Church prior to Anne's death[17][18].
After Darwin discovered evolution, he realized that there was no God, and abandoned his religious beliefs.
Darwin stated many reasons for giving up the literal truth of the Bible[16], however he never saw any incompatibility between evolution and religion. As I stated above, he never became an atheist, and he also stated that, "I feel compelled to look to a First Cause having an intelligent mind in some degree analogous to that of man; and I deserve to be called a theist"[16][20].
Darwin delayed the publication of his work on evolution because he was worried about religious consequences that may arise from its reception.
There's no evidence at all to suggest this is true, and it's simply a modern invention, in fact as I stated above, Darwin saw no conflict with evolution and religion[21].