There are many answers to this question. All of them bear as well on the question, "How Greek are the Greek myths? As often where there are many answers, no single answer will suffice, and all may contain elements of truth. Our business is not to decide among the available answers, but to understand the factors that gave rise to them, and to try to come up with answers of our own to the questions posed above.
Towards the end of the eighteenth century, scholars began to investigate systematically relationships between different languages, and to develop the idea that some languages are related to one another, some more closely than others, and that some language "families" are descended from common ancestors. One of these families came to be known variously as the Indo-European, Indo-Germanic, or Indo-Aryan family, which includes almost all the languages spoken in modern Europe as well as several major languages spoken in the Middle East and in South Asia. Various branches of this family can be distinguished as well. The major way of establishing similarities and making distinctions involves the comparison of similar elements of, eg, vocabulary. A classic example involves the words used in various languages to denote the make parent:
From this comparison, one concludes that all these languages might be related; also that English and German might be more closely related to each other than they are to Spanish or Italian, and that Spanish and Italian might be more closely related to one another than they are to German or English. In fact, evidence of this sort suggests that all the languages mentioned above are descended from a common ancestor, conventionally known as Proto Indo-European, and that the individual languages belong to sub-groups, such as Germanic, Romance, etc.
As we have seen, the supreme god of the Olympian pantheon is Zeus. You probably know that Zeus' equivalent in Roman culture is Jupiter. We shall soon consider the ways in which the Romans assimilated their Jupiter to the model established by the Greek Zeus. Now, however, the point I want to make is that this process was made easier by the fact that Jupiter and Zeus are related by way of Indo-European in the same way that the Greek and Latin languages are related.
One of the central characteristics of both Zeus and Jupiter is that they are considered to be the "fathers" of many of the other gods, and to be the symbolic "fathers" of the universe as a whole. Jupiter's name actually shows this: the Romans also called him "Diespiter" and understood this name to mean "Dies pater" = "Father of the Day" or "Sky Father". "Pater" (="Father") is also a common epithet of the Greek Zeus, who is frequently addressed as "Zeus pater" (="Father Zeus"). Now, the similarity of the names "Jupiter" and "Zeus pater" is noticeable, and anyone conversant with the Indo-European hypothesis might well wonder whether the names were related. If one then learns that there is a a sky god in the ancient Indian pantheon named "Dyaus-pitar" and that this god shows many of the same characteristics ascribed to Zeus and Jupiter, it becomes difficult not to see the same pattern at work in mythology that we have observed in the case of languages.
Thus modern philology has effectively demonstrated that Greek mythology is to at least some extent inherited from a mythology that was originally common to all the Indo-European peoples. It is difficult to be very specific about the forms that this mythology took: we do not have a body of Indo-European poetry that contains myths as elaborate as those of the Greeks, and the myths that do survive in ancient Indian or Irish poetry differ from the Greek myths in many respects. Nevertheless, it seems reasonable to assume that the Greeks did not invent their mythology entirely, but rather that their invention took place within certain parameters established by earlier cultures.
Linguistically, these cultures were outside the Indo-European family, and the general shape of their religious systems too differs from that of the Greeks. Nevertheless, Herodotus did not shrink from tracing certain Greek institutions to the Egyptians in particular, and from identifying certain Greek gods and goddesses with Egyptian counterparts. There is, moreover, the myth of Io and her descendants Io was the daughter of the King of Argos. Seduced by Zeus, she wandered to Egypt and gave birth to a child, Epaphus. Epaphus became the father of Libya -- the name of a large part of northern Africa -- and of Belus, who in turn became the father of Danaus and Aegyptus. Danaus returned to his ancestral Argos, while Aegyptus became king of Egypt. (A portion of this myth is the subject of Aeschylus' Suppliants or Suppliant Maidens.) Thus, acconrding to this myth, the Greeks and the Egyptians were actually related through their ancestors Danaus and Aegyptus, two brothers descended from the Argive heroine Io.
Another myth concerns the foundation of Thebes by Cadmus, who comes to Greece from Phoenicia. One of the deeds ascribed to Cadmus is the invention of the alphabet; and in fact, it is clear that the Greek alphabet (from which our alphabet is descended) was borrowed from that of the Phoenicians. So the myth of Cadmus, which traces the origin of a centrally important Greek cultural institution to Phoenicia, appears to contain a nucleus of historical fact.
These questions are impossible to answer definitively. In some ways it is less important to answer them than it is to understand the implications one might draw from the various answers that one might give. In a modern context, the idea of contact between Greece and the Near East (or conversely that of Greek independence from such contact) has a very different meaning from what it might have had in antiquity, when at least some Greeks believed that they were related to peoples whom modern linguistics, at any rate, regards as belonging to wholly different cultures. This point is illustrated very clearly by the "Black Athena" controversy, so called from the title of a book arguing not only that Greek culture did in fact derive from that of Egypt, but that Egyptian culture was in some sense a "black" culture in a modern Africanist sense. Some explanations of the "origins" of the Greek myths are more or less verifiable than others; but none is free from the interested perspective of interpreters who wish to see themselves in a special relationship with ancient Greek culture.