Chad Oliver's 1959 novelette "Transfusion" (first published in Astounding Science Fiction, June 1959, available at the Internet Archive)
was not the first, but it's a very good example of that microgenre.
But you asked for the first one. In his book Science-Fiction: The Early Years Everett F. Bleiler reviews virtually every work of science fiction ever written, from the beginning of time to 1930. The index lists 15 works under the heading "Human race originated elsewhere", classified as follows:
Alpha centauri (1)
Hollow earth (5)
Mars (2)
Mercury (1)
Moon (6)
Nevada (1)
Saturn (1)
Space spirits, plus pithecanthropus (1)
Venus (1)
These add up to more than 15 because one story has repeated colonizations of earth from different planets. After discarding hollow earth, Nevada, and space spirits as not the kind of "elsewhere" we're looking for, the earliest one seems to be "The Judgment Day in the Moon", a short story by Walter Malone, included in his collection The Coming of the King, Lippincott, Philadelphia, 1897. Here is Bleiler's review of the story:
Hot romance in the past on the moon. * The moon is gradually losing its atmosphere, and the human population has dwindled to a couple of hundred. The great scientist Darus has constructed a spaceship that will take the survivors to the earth, which is still in the mastodon stage and without a human population. The spaceship can leave only at certain planetary conjunctions. * A complication exists in Princess Callistano. Her people and family were killed in war by Prince Lileo, who has since become her lover. She still loves him, but he is tired of her and plans to abandon her on the moon when the spaceship leaves. * Callistano, however, is not so easily rebuffed. She serves Lileo violently aphrodisiacal wine, and the spaceship leaves while they are making love. On discovering what has happened, Lileo dies of apoplexy, and Callistano does not survive him long. The human race on the moon is dead, but presumably the people on the spaceship were our ancestors. * Written in very purple prose. The story benefits from summary.
Note: Bleiler gives the story title as "The Judgment Day in the Moon", but the ISFDB has it as "The Judgment Day of the Moon".