The word is from Renaissance Latin gnomus, a word apparently coined by Swiss alchemist Paracelsus. The English word is attested from the early 18th century. Paracelsus uses Gnomi as a synonym of Pygmæi. He is perhaps deriving the term from Latin gēnomos (itself representing a Greek γη-νομος, literally "earth-dweller". In this case, the omission of the ē is, as the OED calls it, a blunder. Alternatively, the term may be an original invention of Paracelsus'.
The chthonic elemental spirit has precedents in numerous ancient and medieval mythologies, often guarding mines and precious underground treasures, notably in the Germanic dwarves and the Greek Chalybes, Telchines or Dactyls.
The English folklore the chthonic gnome has become a sort of antithesis to the more airy or luminous fairy. Thus, Nathaniel Hawthorne in Twice told tales (1837) contrasts the two in Small enough to be king of the fairies, and ugly enough to be king of the gnomes. (cited after OED). Similalry, gnomes are contrasted to elves, as in William Cullen Bryant's Little People of the Snow (1877), which has "let us have a tale of elves that ride By night, with jingling reins, or gnomes of the mine." (cited after OED).
Franz Hartmann in 1895 satirized materialism in an allegorical tale entitled Unter den Gnomen im Untersberg. The English translation appeared in 1896 as Among the Gnomes: An Occult Tale of Adventure in the Untersberg. In this story, the Gnomes are still clearly subterranean creatures, guarding treasures of gold within the Untersberg mountain.
As a figure of 19th century fairy tales, the term gnome by the 20th century became largely synonymous with other terms for the "little people", such as goblin, brownie, kobold, leprechaun, Heinzelmännchen and other instances of the "domestic spirit" type, losing its strict association with earth or the underground world.
After World War II (with early references, in ironical use, from the late 1930s) the diminutive figurines introduced as lawn ornaments during the 19th century came to be known as garden gnomes. The image of the gnome changed further during the 1960s to 1970s, when the first plastic garden gnomes were manufactured. These gnomes followed the style of the 1937 depiction of the seven dwarves in Snow White and the Seven Dwarfs by Disney. This "disneyfied" image of the gnome was built upon by the illustrated children's book classic The Secret Book of Gnomes (1976), in the original Dutch Leven en werken van de Kabouter.
The expression of the "Gnomes of Zurich", Swiss bankers pictured as diminutive creatures hoarding gold in subterranean vaults, was coined in 1956 by Harold Wilson and gained currency in the 1960s (OED notes the New Statesman issue of 27 November 1964 as earliest attestation).