More importantly, its a way of releasing anger when something happens, but unlike the originator - "Damn", it doesnt roll off the tongue so easily and would appear to repress the repressed 'religious types' even moreso than if they had gone all out and said the word "Damn"
Mom: (gasp) You can't say damn! That's a bad word! Say darn instead.
6 year old boy: That sounds stupid! I wanna say damn!
Mom: If you say damn anymore, God is going to send you to hell when you die!
6 year old boy: Oh, okay, I'll say darnit instead.