KIRK: Apollo's no god. But he could have been taken for one, though, once. Say five thousand years ago, a highly sophisticated group of space travellers landed on Earth around the Mediterranean.
MCCOY: Yes. To the simple shepherds and tribesmen of early Greece, creatures like that would have been gods.
KIRK: Especially if they had the power to alter their form at will and command great energy. In fact, they couldn't have been taken for anything else.
So far as I can tell, Star Trek wasn’t airing in Switzerland in 1967, so this couldn’t have had an influence on Erich von Däniken, who cribbed his Chariots from the Lovecraft-inspired Morning of the Magicians anyway.
The Star Trek discussion of the gods, particularly Apollo, echoes the plot of the Homeric Hymn to Apollo (lines 388ff.) in which the god makes his first appearance to humans. He transforms into a dolphin and throws himself up onto a ship full of men, driving their boat by magic to Delphi, where the men would become his priests. There, he transformed into his human-like form and used his ability to display fiery arrows to induce fear in the populace. Only later did the man-like form reveal his divinity, after the people aboard ship refused to believe he was a man but instead declared that he must be a god. Apollo therefore commanded the men to worship him.
As is probably obvious, a science fiction writer—especially any who had read deeply in the pulp era stories of aliens and gods—could easily envision this as a story of an alien who wields strange technology, can change form, and commanded the cowed populace to worship him. This echoes what Arthur C. Clarke would state as his third law in 1973, “any sufficiently advanced technology is indistinguishable from magic.”
Perhaps most interestingly, I cannot find a reference to the Homeric Hymn to Apollo in any ancient astronaut book, which is particularly surprising given the obvious ancient astronaut themes in the Homeric Hymn. Could it be that ancient astronaut authors have never read the Homeric Hymns? Since even the most “scholarly” ancient astronaut author, Robert Temple, did not bother to read the Greek works he claimed to analyze (his notes in the Sirius Mystery reference only secondary sources for most myths), it wouldn’t surprise me at all.
In von Däniken’s own “analysis” of aliens in ancient Greece, Odyssey of the Gods (2000), he relates part of the story from the Homeric Hymn but betrays no knowledge of the original. It is clear from the discussion on p. 72 (and the absence of any reference to the Hymn in the text or notes) that he knows the story only secondhand and never bothered to consult the original. He says that Apollo “journeyed to Delphi in a ‘heavenly vessel’” (this must be the boat he seizes since the Hymn does not assign Apollo a vessel when he first travels to Delphi) but is completely unaware that Apollo was a shape-shifting deity who performed “technological” miracles with his fiery arrows before demanding worship as a god!
So, in sum, Star Trek's Ralston was able to create a more interesting riff on Greek myth and extraterrestrials, with a more knowledgeable adaptation of the actual ancient texts, than the supposed non-fiction author who claims that ancient texts he's never read reveal alien truths!