The easiest and most common answer to that question is this: "If Bilbo had not lost his matches, he wouldn't have found the One Ring. In chapter 5, Bilbo wakes up after hitting his head and being knocked out. He does not have any matches, so he is forced to fumble around on all fours. During this process, his hand brushes up against something metallic.
Because his sword glows in the dark when orcs are near. If Bilbo had his matches, he would have attracted much unwanted attention in the dark. And it might have allowed the unwanted creatures to find him as well. The light and the smell of the match would have brought them out. After Bilbo wins the riddle game, Gollum decides to try to eat him.
How does Bilbo to know his sword was made in by elves? Bilbo recognises that the sword is made by elves as he sees the the sword glow when the sword is near the Goblins. Its good that Bilbo lost his matches as ends up finding the ring when he is finding his way around the dark, or else someone could have smelt the fire or the tobacco burning and the act of looking for them revealed his anger. How does Gollum guess that Bilbo has his ring? How do the Goblins know that someone is at the gate?
It "was good" that Bilbo lost his matches because the flicker of light and odor of sulphur that a match would have produced could have attracted potential dangers in the darkness, like Orcs or other creatures. Tolkien plainly states this in the same paragraph. Because if he had had his matches, he would have been able to light a pipe, and that would have attracted much unwanted attention in the dark.