Prior to 1750, one of the most important geological thinkers was Niels Steensen (1638–1686), or Steno, a Danish anatomist and geologist. He established the principle of superposition, namely that sedimentary rock layers are deposited in a successive, essentially horizontal fashion, so that a lower stratum was deposited before the one above it. In his book Forerunner (1669), he expressed belief in a roughly 6,000-year-old earth and that fossil-bearing rock strata were deposited by Noah’s flood. Over the next century, several authors, including the English geologist John Woodward (1665–1722) and the German geologist Johann Lehmann (1719–1767), wrote books essentially reinforcing that view.

In the latter decades of the 18th century, some French and Italian geologists rejected the biblical account of the Flood and attributed the rock record to natural processes occurring over a long period of time. Several prominent Frenchmen also contributed to the idea of millions of years. The widely respected scientist Comte de Buffon (1707–1788) imagined in his book Epochs of Nature (1779) that the earth was once like a hot molten ball that had cooled to reach its present state over about 75,000 years (though his unpublished manuscript says about 3,000,000 years). The astronomer Pierre Laplace (1749–1827) proposed the nebular hypothesis in his Exposition of the System of the Universe (1796). This theory said that the solar system was once a hot, spinning gas cloud, that over long ages gradually cooled and condensed to form the planets. Jean Lamarck, a specialist in shell creatures, advocated a theory of biological evolution over long ages in his Philosophy of Zoology (1809).

Abraham Werner (1749–1817) was a popular mineralogy professor in Germany. He believed that most of the crust of the earth had been precipitated chemically or mechanically by a slowly receding global ocean over the course of about a million years. It was an elegantly simple theory, but Werner failed to take into account the fossils in the rocks. This was a serious mistake, since the fossils tell much about when and how quickly the sediments were deposited and transformed into stone. Many of the greatest geologists of the 19th century were Werner’s students, who were impacted by his idea of a very long history for the earth.

In Scotland, James Hutton (1726–1797) was developing a different theory of earth history. He studied medicine at the university. After his studies, he took over the family farm for a while. But he soon discovered his real love: the study of the earth. In 1788 he published a journal article and in 1795 a book, both by the title Theory of the Earth. He proposed that the continents were being slowly eroded into the oceans. Those sediments were gradually hardened by the internal heat of the earth and then raised by convulsions to become new landmasses that would later be eroded into the oceans, hardened, and elevated. So in his view, earth history was cyclical, and he stated that he could find no evidence of a beginning in the rock record, making earth history indefinitely long.

Source: https://answersingenesis.org/theory-of-evolution/millions-of-years/where-did-the-idea-of-millions-of-years-come-from/