There are two questions here: the origin of the idea of the ‘halfling’, and the origin of the word ‘hobbit’. The former seems to be adequately explained by European folklore, which describes dwarfs, elves, fairies, goblins, brownies, kobolds, leprechauns, and other kinds of small magical people. So I will concentrate on the latter.
Tolkien described the origin of the word in a letter to W. H. Auden:
All I remember about the start of The Hobbit is sitting correcting School Certificate papers in the everlasting weariness of that annual task forced on impecunious academics with children. On a blank leaf I scrawled: ‘In a hole in the ground there lived a hobbit.’ I did not and do not know why. I did nothing about it, for a long time, and for some years I got no further than the production of Thror’s Map. But it became The Hobbit in the early 1930s
J. R. R. Tolkien (1955). Letter to W. H. Auden. Number 163 in Humphrey Carpenter, ed. (1981). The Letters of J. R. R. Tolkien. London: George Allen & Unwin.
His biographer Humphrey Carpenter quoted another version of the story but (following his usual slipshod practice) without reference:
It was on a summer’s day, and he was sitting by the window in the study at Northmoor Road [in Oxford], laboriously marking School Certificate exam papers. Years later he recalled: ‘One of the candidates had mercifully left one of the pages with no writing on it (which is the best thing that can possibly happen to an examiner) and I wrote on it: “In a hole in the ground there lived a hobbit”. Names always generate a story in my mind. Eventually I thought I’d better find out what hobbits were like. But that’s only the beginning.’
Humphrey Carpenter (1977). Tolkien: A Biography, p. 172. Boston: Houghton Mifflin.
This must have been fairly soon after Tolkien took up his post as Professor of Anglo-Saxon at Pembroke College, Oxford, in 1925.
How are we to reconcile Tolkien’s version of events with the appearance of the word in the list of supernatural beings in the tracts of folklorist Michael Denham?
[…] pigmies, chittifaces, nixies, Jinny-burnt-tails, dudmen, hell-hounds, dopple-gangers, boggleboes, bogies, redmen, portunes, grants, hobbits, hobgoblins, brown-men, cowies, dunnies, wirrikows, alholdes, mannikins, follets, korreds, lubberkins, cluricauns, kobolds, leprechauns, kors, mares, korreds, puckles, korigans, sylvans, succubuses, black-men, shadows, banshees, lian-hanshees, clabbernappers, Gabriel-hounds, mawkins, doubles, corpse lights or candles, scrats, mahounds, trows, gnomes, sprites, fates, fiends, sybils, nick-nevins, whitewomen, fairies, thrummy-caps […]
James Hardy, ed. (1895). The Denham Tracts: A Collection of Folklore by Michael Aislabie Denham, volume II, p. 79. London: David Nutt.
There seem to be two possibilities: either Tolkien had in fact read the word in Denham (or some other source yet undiscovered) but had forgotten that he had done so; or the two occurrences of the word are independent inventions. The problem with the first of these possibilities is that Denham’s tracts are obscure:
Denham was an amateur folklorist who published many books and pamphlets, including twenty Minor Tracts on Folklore (1849–c. 1854). The majority of these Tracts were collected in an edition prepared for the Folklore Society in the 1890s, and the word hobbit appears in the second volume (1895) of this edition.
Peter Gilliver, Jeremy Marshall & Edmund Weiner (2006). The Ring of Words: Tolkien and the Oxford English Dictionary, p. 146. Oxford University Press.
In the absence of any evidence that Tolkien read Denham’s work, Gilliver et al. have to resort to speculation about how he might have done so:
The 1895 version would have been readily available in university libraries accessible to Tolkien (there is a copy in Oxford), and he was interested in folklore. Alternatively, he could have seen a list copied out by one of his friends or colleagues.
Gilliver et al., p. 148.
There is the tantalizing possibility of another source for the word. A letter to the Observer soon after the publication of The Hobbit in 1937, asked about the origins of the name:
Sir,—Dr. Julian Huxley, in one of his recent lectures, referred to the “little furry men” seen in Africa by natives and, although dimly in moonlight, by at least one scientist.
What I should like to know is whether these creatures provided the inspiration for Professor Tolkien’s attractive hobbit, the newest visitor to so many of our nurseries this Christmas. Naturally, I always read my children’s book before giving them to them, and I noticed that all the characters in the hobbit were nearly all drawn from real animal life or from real mythology. Few of them appeared to be invented.
On mentioning the hairy-footed hobbit, rather like a rabbit, to one of my contemporaries, I was amazed to see her shudder. She said she remembered an old fairy tale called “The Hobbit” in a collection read about 1904. This creature, she said, was definitely frightening, unlike Professor Tolkien’s. Would the Professor be persuaded to tell us some more about the name and inception of the intriguing hero of his book? It would save so many research students so very much trouble in the generations to come. And, by the way, is the hobbit's stealing of the dragon's cup based on the cup-stealing episode in Beowulf? I hope so, since one of the book's charms appears to be its Spenserian harmonising of the brilliant threads of so many branches of epic, mythology, and Victorian fairy literature. Yours, etc. ‘Habit’
‘Habit’ (16 January 1938). Letter to The Observer.
Tolkien replied, denying any knowledge of the “old fairy tale”:
I was born in Africa, and have read several books on African exploration. I have, since about 1896, read even more books of fairy-tales of the genuine kind. Both the facts produced by the Habit would appear, therefore, to be significant.
But are they? I have no waking recollection of furry pigmies (in book or moonlight); nor of any Hobbit bogey in print by 1904. I suspect that the two hobbits are accidental homophones, and am content* that they are not (it would seem) synonyms.
* Not quite. I should like, if possible, to learn more about the fairy-tale collection, c. 1904.
J. R. R. Tolkien (1938). Letter to The Observer. Number 25 in Carpenter (1981).
The “old fairy tale” has not turned up in 80 years of searching, and so it seems that ‘Habit’s friend was mistaken in her recollection, perhaps at the distance of 34 years having confused ‘The Hobbit’ with a similar-sounding title. An example of a tale that could fit the bill is ‘The Bar-gaist, or Boggart’ which was printed in John Roby’s Traditions of Lancashire (1829).
So I think it is more likely that Denham’s and Tolkien’s ‘hobbit’ are independent inventions. There is a word ‘hob’ (an abbreviation of ‘Robin’) from which they could both derive:
hob, n.1 2.a. = Robin Goodfellow or Puck; a hobgoblin, sprite, elf.
Oxford English Dictionary
This gave rise to the compounds ‘hobgoblin’ (an imp or sprite; a terrifying apparition), ‘hobhouchin’ (an owl), and ‘hob-thrush’ (a goblin), so it could also have assisted with the coining of ‘hobbit’.