The Messenger of Allah (PBUH) did not claim himself as the author or the owner of the Quran, but he told us it is an inspiration sent down to him by Jibrîl (PBUH) in portions within twenty-three years.
The Quran confirmed this fact as Allah the Almighty Says: “Say: "Allah is Witness between me and you: this Qur'an hath been revealed to me by inspiration That I may warn you and all whom it reaches, [Surah Al-Anam, verse 19]. The Almighty described the Quran as a revelation: “It is but a revelation revealed”, [Surah Al-Najm, verse 4], "Say: "I but follow what is revealed to me from my Lord", [Surah Al-Araf, verse 203], " and Allah Says "I only follow that which is revealed unto me” [Surah Yunus, verse 15].
No doubt, the topic of revelation is metaphysically, and humans cannot be aware of its essence with their limited senses or bare minds, so the only authentic source for the truth of revelation is the Qur’an, which was revealed by Allah, and His Messenger to whom was the Qur'an revealed. The Qur'an pointed out that Allah does not speak to humans directly, The Almighty Says: (It is not given to any human being that Allâh should speak to him unless (it be) by Revelation, or from behind a veil, or (that) He sends a Messenger to reveal what He wills by His Leave. Verily, He is Most High, Most Wise. Thus, We have sent to you (O Muhammad SAW) Ruh (a Revelation, and a Mercy) of Our Command. You knew not what the Book is, nor what is Faith? However, We have made it (this Qur'ân) a light wherewith We guide whosoever of Our slaves We will. Moreover, verily, you (O Muhammad SAW) are indeed guiding (mankind) to the Straight Path (i.e. Allâh's Religion of Islâmic Monotheism). (52) The Path of Allâh, to Whom belongs all that is in the heavens and all that is in the earth. Verily, all the matters at the end go to Allâh), [Surah Ash-shura, verses 51-53].
Jibrîl (PBUH) repeatedly descended down with the Quran to the prophet (PBUH), within twenty-three years, and the result was the revelation of the whole and holly book. Normally, the prophet (PBUH) used to memorize the verses once they were revealed, then ordered his Sahahabs to write them down, and then taught the revelation to his companions. Some of the Sahabas memorized the whole Quran, and some partially. They memorized the Quran by hearts and wrote it down as a book.