Keeping in mind that this is the type of question that can have different answers depending on one's school of thought, here are a couple of relevant quotes:
Berachot 5a
וא"ר לוי בר חמא אמר ר' שמעון בן לקיש מאי דכתיב ואתנה לך את לוחות האבן
והתורה והמצוה אשר כתבתי להורותם לוחות אלו עשרת הדברות תורה זה מקרא
והמצוה זו משנה אשר כתבתי אלו נביאים וכתובים להורותם זה גמרא מלמד שכולם
נתנו למשה מסיני
R. Levi b. Hama says further in the name of R. Simeon b. Lakish: What
is the meaning of the verse: And I will give thee the tables of stone,
and the law and the commandment, which I have written that thou mayest
teach them? ‘Tables of stone’: these are the ten commandments; ‘the
law’: this is the Pentateuch; ‘the commandment’: this is the Mishnah;
‘which I have written’: these are the Prophets and the Hagiographa;
‘that thou mayest teach them’: this is the Gemara. It teaches [us]
that all these things were given to Moses on Sinai. (Soncino
translation)
Rashi there defines Gemara as the reasoning by which we can derive halachic rulings from the Mishnayot:
סברת טעמי המשניות שממנו יוצאה הוראה
We can therefore, perhaps, infer that other things were not given to Moshe on Sinai, including midrashim and aggadeta which are not mentioned in this list.
R. Shmuel Hanagid writes in his Introduction to Talmud that haggadah refers to anything in the Talmud that is not about a mitzvah. He says that we cannot add or subtract anything which Chazal determined as halacha regarding a mitzvah that comes from Moshe who received it from God. This is in contrast to their explanations of verses which are whatever the sage thought of, and which we should only rely upon if they make sense:
והגדה הוא כל פי' שיבא בתלמוד על שום ענין שלא יהיה מצוה זו היא הגדה
ואין לך ללמוד ממנה אלא מה שיעלה על הדעת ויש לך לדעת שכל מה שקיימו חז"ל
הלכה בענין מצוה שהיא מפי משה רבינו ע"ה שקבל מפי הגבורה אין לך להוסיף
עליו ולא לגרוע ממנו אבל מה שפירשו בפסוקים כל אחד כפי מה שנזדמן לו ומה
שראה בדעתו ולפי מה שיעלה על הדעת מן הפירושים האלו לומדים אותם והשאר
אין סומכין עליהם
This seems to indicate that aggadeta and midrashim were not given to Moshe on Sinai.
In fact, R. Dovid Tzvi Hoffman explicitly states that aggadah was not given on Sinai and there is no obligation for us to accept it. He adds that we must uphold the words of R. Shmuel Hanagid (cited above).
He'arot Mukdamot Klaliyot
שכן אותם פתגמים סיפורים דברי חכמה ומוסר הכלולים בשם "אגדה" ושענינם הוא
להביע משל חכמה ומוסר או ביאור לכתובים שאין בהם חוקים אין לומר עליהם
שניתנו מסיני ואין עלינו שום חיוב לקבלם בענין זה עלינו להחזיק בדברי ר'
שמואל הנגיד במבוא התלמוד שלו