Bilbo names his sword "Sting", after he uses it to kill the giant spider. He does this by himself in Mirkwood, and in doing so frees himself and his friends from the spider. This leaves him feeling much more sure of himself and his abilities. Sting is really a large dagger, rather than a sword, but as Hobbits are small it makes an effective sword for him. When he returns to the Shire, Sting hangs over Bilbo's mantelpiece, until Bilbo gives Sting to Frodo to assist him in destroying the One Ring.
In a major turning point of The Hobbit, Bilbo Baggins manages to kill the enormous spider of Mirkwood, thus saving himself and his comrades from being eaten by the creature who had bound them in its sticky webs.
This is a major personal victory for Bilbo and one of the first times that he has been successful in combat on his own. It is an action that thoroughly alters Bilbo as a person because it indicates his ability to act on the behalf of the common good, rather than behaving selfishly or cowering in constant fear. He proves himself to be heroic; as is classically worthy of a hero, he has now symbolically earned the right to name his weapon as a method of solidifying his new reputation.
Thus, Bilbo names his small but handy sword "Sting" because it has resulted in him feeling "much fiercer and bolder in spite of an empty stomach." This honorable weapon remains with Bilbo until eventually being passed onto Frodo in The Lord of the Rings series.
Bilbo names his sword sting because it is made by elves from "Mithrail Silver". The sword glows blue when Orcs are present. Bilbo figures that the sword will give the Orcs a sting because it is really not much more than a dirk compared to the larger swords that the others in the traveling party bring with them. However, Bilbo is able to free the dwarves from the spidres by using Sting to cut the webs.
He is careful with Sting and later passes it on to Frodo in another book.
Ok Orcs have nothing to do with why Bilbo named it Sting, and while it is of Elven make it's not made of Mithril as only the Dwarves worked with Mithril. Sting is named wholly because of Bilbo's encounter with the spiders
"Somehow the killing of the giant spider, all alone by himself in the dark without the help of the wizard or the dwarves or of anyone else, made a great difference to Mr. Baggins. He felt a different person, and much fiercer and bolder in spite of an empty stomach, as he wiped his sword on the grass and put it back into its sheath."
"I will give you a name," he said to it, "and I shall call you Sting."