За гранью времен by H. P. Lovecraft

After a devastating mental breakdown, a New England professor loses years to a strange personality change and is later haunted by vivid dreams of inhabiting an alien archivist in a prehistoric city. Gradually he deduces that his mind was swapped across ages by a species that catalogs knowledge by exchanging consciousness with beings throughout time. Seeking proof, he mounts an expedition to the Australian desert, uncovers the buried city from his visions, and narrowly escapes a primordial subterranean horror. The tale probes identity, memory, and humanity’s smallness against the vast span of cosmic history.