Upnayan(Janeyu) tradition is the part of an education procedure, which provides to a child at a particular age, it is also part of upbringing of Child, it is known as Upnayan Sanskar.
In it a person assume(hold) a janeu(a thread three-fold) there are three knots in it which is mark of three chief Gods of Hindu's Bramha,Vishnu And Mahesh.
It was wore by every cast people at that time when only 4 casts existed in hindu Bramhin, Kshatriya, Vaishya and Shudra. The tradition is made by our sages.
There are both scientific and Religious reasons behind it
One feels steady that the god always with me in form of Janeu, I am the offspring of god.
Janeu symbol of god existence with holder(who holds Janeu) which inspires a man to avoid misdeeds.
When a man goes for urine or latrine ,he hangs and folds Janeu over the right ear
There is a blood vessel named Lohitika on right ear, it is pressed by Janeu, it helps to release urine or latrine freely and reduces the diseases related to them.