When was golf invented according to The Hobbit?
This is a humorous aside that Tolkien adds to appeal to the more juvenile reader at which The Hobbit is directed, as opposed to the more serious tone of The Lord of the Rings, intended for an older audience.
In the scene, Thorin had explained their purpose in meeting and of their journey. He mentioned that they might "never return," at which Bilbo becomes extremely upset, shrieks, causing Gandalf to strike a flame with his staff, and generating confusion and excitement. Bilbo is carried off to another room, so the meeting can continue. Gandalf explains Biblo's behavior as given to sudden fits, but he is "as fierce as a dragon in pinch."
The narrator breaks in with an observation that this is a poetical exaggeration regarding any hobbit, even the Old Took's great-granduncle, Bullroarer, who, in the Battle of the Green Fields, struck off the goblin king Golfimbul's head with a wooden club, sending it down a rabbit hole. In this way, the narrator states, the battle was won and the game of Golf (from the shortened form of Golfimbul) invented at the same time.