This story can be found in the Prose Edda.
Fenris was the offspring of Loki and Angerboda. He was raised in Asgard by the gods where they could watch over him. He grew so large that the gods became afraid of him. Only Tyr was brave enough to feed and take care of Fenris. The gods decided that they had to bind him so he wouldn't be able to cause them harm.
The gods crafted the strongest iron chain known and attached it to Fenris. Fenris easily broke this first chain, Laeding. The gods then crafted a second chain, Dromi. This chain was twice as strong as the first, but Fenris thought he had grown in strength since he had broken Laeding and knew he would have to expose himself to danger in order to become famous. He allowed the gods to put the fetter upon him. He then struggled and shook until the chain flew apart. After this, the gods decided to send Skirnir to the dwarves to get them to craft something that would be able to hold Fenris.
The dwarves fashioned a silken bond out of six things: the sound of a cat's footfalls, the beard of a maiden, the roots of a mountain, the dreams of a bear, the breath of a fish and the spittle of a bird. The bond they fashioned was called Gleipnir.
The gods brought this silken bond before Fenris and bade him attempt to break it. The gods convinced Fenris to allow them to bind him with this silken bond. They told him if he wasn't able to break free, then they would have no reason to fear him. Wary of treachery, aware that there was likely some magic in the silken bond, Fenris said he would agree only if one of the gods consented to place his hand in his mouth. The gods hesitated, but Tyr stepped foward and placed his right hand between the wolf's jaws.
The gods fastened Gleipnir to Fenris and he attempted to break free. As he struggled to free himself, the bond only got tighter. When he realized he could not break free, he closed his jaw and took Tyr's right hand. When the gods realized he was truly bound they attached Gleipnir to a heavy chain called Gelgia which they ran through a hole in a large rock called Gioll. Fenris opened his mouth extraordaniraly wide and attempted to bite at the gods while they were fastening the chain. The gods then placed a sword in his jaw, it's hilt in his lower jaw and it's point in his upper. Fenris howls terribly, and the slaver running from his mouth forms a river. He will remain chained until Ragnarok.
Forever after, Tyr has been known as the god of duty, for he knew it was his duty to make the sacrifice for the greater good.