Wells had considered the notion of time travel before, in a short story titled "The Chronic Argonauts" (1888). This work, published in his college newspaper, was the foundation for The Time Machine.
Wells frequently stated that he had thought of using some of this material in a series of articles in the Pall Mall Gazette until the publisher asked him if he could instead write a serial novel on the same theme. Wells readily agreed and was paid £100 (equal to about £11,000 today) on its publication by Heinemann in 1895, which first published the story in serial form in the January to May numbers of The New Review (newly under the nominal editorship of W. E. Henley). Henry Holt and Company published the first book edition (possibly prepared from a different manuscript) on 7 May 1895; Heinemann published an English edition on 29 May. These two editions are different textually and are commonly referred to as the "Holt text" and "Heinemann text", respectively. Nearly all modern reprints reproduce the Heinemann text.
The story reflects Wells's own socialist political views, his view on life and abundance, and the contemporary angst about industrial relations. It is also influenced by Ray Lankester's theories about social degeneration and shares many elements with Edward Bulwer-Lytton's novel Vril, the Power of the Coming Race (1871). Other science fiction works of the period, including Edward Bellamy's novel Looking Backward: 2000-1887 (1888) and the later film Metropolis (1927), dealt with similar themes.
Based on Wells' personal experiences and childhood, the working class literally spent a lot of their time underground. His own family would spend most of their time in a dark basement kitchen when not being occupied in their father's shop. Later, his own mother would work as a housekeeper in a house with underground tunnels, where the staff and servants lived in underground quarters. A medical journal published in 1905 would focus on these living quarters for servants in poorly ventilated dark basements. In his early teens, Wells became a draper's apprentice, having to work in a basement for hours on end.
This work is an early example of the Dying Earth subgenre. The portion of the novella that sees the Time Traveller in a distant future where the sun is huge and red also places The Time Machine within the realm of eschatology, i.e. the study of the end times, the end of the world, and the ultimate destiny of humankind.