The Greeks had a large number of stories about gods and supernatural beings. How did these stories come about? Were many of them taken from other cultures, or were they mostly created by Greeks themselves?
So, before diving into this, a little background that at first may not seem particularly relevant, but bear with me. Modern English stems from Old English, which systems from a language we nowadays call Proto-Germanic. Languages like Swedish, German, Norwegian, and dead languages like Gothic all extend from Proto-Germanic.
Proto-Germanic developed from a language known by scholars as Proto-Indo-European. Ultimately, so did all of the Romance languages (Latin is the best known branch of the Italic language family), and so did Greek, along with a bunch of other languages, like Iranian and Vedic Sanskrit.
As you know, language is crucial for communication, and we reference all sorts of things throughout our day when we use it. One of the things we frequently mention is folklore topics, whether it's a reference to myth (we reference Old English myth every time we mention English weekday names, for example), folklore motifs like ghosts, or just other folklore stuff like jokes or other idiomatic expressions. Like language, we inherit these concepts from earlier generations, not uncommonly much earlier generations.
Language changes over time, and so does myth, but aspects of both may remain consistent and conservative, such as specific words or word elements or certain associations folklore figures maintain.
A good example of this is the deity Zeus. Briefly, by way of what historical linguists call the comparative method, linguists know that this deity extends from the same origin as numerous other deities mentioned in other Indo-European languages, and sometimes these deities share certain associations, like the sky and ruling. In turn, from linguistic descendants, historical linguists can reconstruct that earlier deity, and show that they all derive from a common origin, associations and all. (Sometimes they can even reconstruct narratives with varying degrees of confidence.)
In a sense, it's a sort of academic necromancy. But it's not all-powerful: The method is limited by the constraints of the record. For example, some scholars once proposed that the Greek god Dionysus was a somewhat recent addition to the Greek corpus when, say, Homeric texts were composed. However, later this theory was proven wrong when a mysterious script used by the Bronze Age Greeks (Mycenaeans), Linear B, was finally cracked. It contained references to Dionysus. It happens.
This highlights a big problem with analyzing this stuff: As in language, innovation occurs both quite naturally and quite commonly—sometimes new features and concepts develop under factors that may be extremely tough to explain or, alternately, quite straightforward. Consider, for example, how would a deity associated with blacksmithing develop prior to the introduction of the accompanying technology? Was there a somehow comparable deity who absorbed this function? How might a narrative change over time if a group moves to a new location, a group is invaded, or a new concept is introduced?
In short, we often can't trace exactly where a figure or its associations developed in folklore, but we can sometimes get a good idea, especially when the written record allows us to analyze things such as deity names (theonyms) or certain expressions. It helps a lot when we're able to compare one body of texts to another related body of texts reaching over a broad span of time.
In the case of the ancient Greeks, it's pretty clear at this point to most scholars that Ancient Greeks not only inherited aspects from their Bronze Age Mycenaean forebears and their distant Proto-Indo-European ancestors, but they were also influenced by surrounding peoples, some of them more historically closely related to the Greeks than others.
If all this sounds interesting to you, then I highly recommend you get ahold of the following book—it will no doubt take you down some paths you might not go down otherwise:
* Puhvel, Jaan. 1987. Comparative Mythology. John Hopkins University Press.
Puhvel's book is low-priced, dense, and covers topics rarely discussed in English, such as the Slavic corpus.
A word of broad caution, though: When diving into this topic, comparative mythology, be wary of the usual red flags—somebody wants to sell you something, Youtube Nazi shit, etc. Another problem you might encounter in these quarters are figures with purely linguistic backgrounds commenting on broader topics without the necessary training in the other areas of the humanities, so be wary of that sort of thing as well.
Best of luck!
Edit: Added publisher link, banished typos