We don't have to assume that the aliens know Latin! The supposition is that the future humans call their home planet Terra instead of Earth and call themselves Terrans, and the aliens follow suit. The idea is that, in a science-fictional future where space travel is commonplace, the Earth, instead of being the World, is a place; and, like any other place, it should have a proper name, instead of a common noun meaning "dirt". (I've been told that, if you know Latin, then "Terra" is no better than "Earth", and "Tellus" would be a better choice. In fact, in some science fiction stories the Earth is called Tellus and its people are Tellurians.)
According to the Historical Dictionary of Science Fiction, the earliest known use of "Terran" as a noun meaning "a native or inhabitant of the planet Earth" (aka Earthian, Earthie, Earthling, Earthman, Tellurian, Terrestrial, Terrestrian, etc.) was in Astounding Science Fiction, April 1946 (available at the Internet Archive), in part 2 of the serialization of George O. Smith's novel Pattern for Conquest. The quotation is from p. 10, column 2:
Neckal spoke: "The battle progresses."
Vorgan frowned. "Why or how can one so small defend himself against one of the Planet of Terror?"
"The Little Man is agile and the Terran is clumsy."
Lindoo nodded. "We may both curse and praise that. If the Terran were less clumsy, he might well be more difficult for Kregar."
The earliest citation for "Terran" as an adjective is from part 1 of the same story, in *Astounding Science Fiction, March 1946, available at the Internet Archive. The quotation is from p. 9, column 1:
Stellor Downing was Martian by birth and by six hundred years of Martian-born forebears. His family could trace its line back to the first group of Terran colonists that braved the rigors of Martian life before technology created a Martian world that was reasonably well adapted for human life.
However, the form "Terrane" was seen earlier, in the 1881 novel Three Hundred Years Hence by William Delisle Hay:
I am speaking of the Terrane Exodus and the Cities of the Sea.
The earliest citation for "Terra" as a name for the planet Earth is from an 1871 lecture "Science & Revelation" by Robert Payne Smith:
Now, let us suppose ourselves philosophers come, we will say, from the planet Jupiter, on a mission intrusted to us by the Jovians, to examine and report upon the nature of the creatures which people the four inferior planets, Terra, Venus, Mercury, and Mars.
Jeff Prucher, an associate of the Science Fiction Citations site (precursor to the Historical Dictionary of Science Fiction), wrote the following essay on "Earthlings" in his Hugo-winning book Brave New Words: The Oxford Dictionary of Science Fiction:
In science fiction, when beings from different worlds encounter each other, they are generally named by their planet or star of origin; thus Martians are from Mars, and Sirians are from some hypothetical planet orbiting the star Sirius. While there are generally few terms in use for beings from any given planet or solar system, there is much greater variety in the terms for people who are from Earth. Many of these terms have been in use for centuries in other senses. Some, such as Earthling and Terrestrial, originally designated earthly (as opposed to heavenly or spiritual) beings. Terrestrian was once an adjective used to describe animals that lived on land rather than in water. Earth-man and -woman once referred only to beings that were associated with soil or the ground in some way; once SF writers got hold of them, they added Earth-folk, Earth-girl, and Earth-person as variations. SF writers also coined the fairly common terms Terran, Tellurian (after Tellus, the Roman goddess of the earth), Earther, Earthian, and Earthie, in addition to many more that never quite caught on, including Earthan, Terrene, and Terrestial. However, when faced with creatures from another star system entirely, beings from the Moon or Jupiter may seem slightly less alien, and so the word Solarian was coined to refer to any inhabitant of Earth's solar system, human or otherwise—Earthling, Martian, and Plutonian alike.