Once when I visited a Durga temple, a man who was giving out flowers to all devotees told me to tie my hair and not leave it open in the temple. I genuinely want to know the reason.
Setting your hair loose is not suggested not only when you visit temples but also when you are at home. Setting your hair loose is an indication of sorrow, grief, inauspicious things poverty and sins.
- Draupadi devi in Mahabharata does not tie her hair after her insult from the Kauravas in the kurusabha. She vows that she would only tie a knot to her hair when washed with the blood of Dushhasana. She was in immense anger and grief and she set her hair loose.
- Loose hair is an invitation to Jyeshta devi, the goddess associated with poverty, sorrow, inauspicious things and bad fortune. Tied hair (plaited) is an invitation to Lakshmi devi, goddess of wealth, fortune, prosperity. Ladies who cook food and brush their teeth with loose hair are vulnerable to Jyeshta Devi.
- Especially, elders advise to plait the hair rather than putting a clip because the bottom part of the hair of a woman has the abiliy to awaken the power of Kundalini Shakthi. So it is advised to be with plaited hair than loose hair.
- When you consider general reason for it, loose hair is more likely to hair fall and hair is not supposed to fall in our homes. So it should be prevented by tying it.
Hence loose hair is strictly forbidden in temples which are places of happiness and prosperity and places of God. For the reasons stated above, it is also forbidden anytime in Hindu religion.
A similar question is answered by Dr.Machiraju Venugopal in an episode of TV show called Dharmasandehalu. Watch it here.