The Question:
Why are there only 4 canonical gospels and why have the rest been discarded?
(An) Answer:
Usually Muslims ask it the other way around. We read in the Qur'an only of one Gospel (of Jesus) and we find in the Bible four Gospels according to Matthew, Mark, Luke and John. Where is the Gospel of Jesus?
I am convinced that Muhammad talked about something "real". What could that have been? What do we know existed at this time in this area?
Most churches around Arabia, Syria etc where Muhammad might have had contact with Christians were using the scriptures in the Syriac translation.
In about A.D. 170 Tatian, a native from Assyria, introduced his edition of the gospels, the "Diatessaron" [originally a musical term meaning "harmony of four", the name already indicating clearly what sort of edition it was]. It was produced by dividing up the four canonical Gospels of Matthew, Mark, Luke and John into small parts and reassembling them together into one continuous gospel narrative.
[This can be compared to taking the "Qur'an in chronological order (as it came to/from Muhammad) and then putting it together again in the order we see it now...]. For the most part the Gospel account according to John was the "basis" for the Diatessaron with the parts from the other gospels inserted into it at the most likely place.
The Diatessaron became a very popular and influential edition, so much so that for a long time the the Syriac New Testaments included the Diatessaron _instead_ of the four original four gospels. It was the preferred edition of the gospel in the Syriac churches for over 200 years, and they were very reluctant to exchange it for the "separated gospels" in the fifth century when the Peshitta, a new Syriac translation of the New Testament, was made. But the unity with the other churches won out. The Diatessaron continued to be used though, both in Syriac as well as in Greek and Latin translations in the Eastern and Western churches.
Since Muhammad would most probably have had contact with Christians using the scriptures in the Syriac translation, it might well be that these churches still used the Diatessaron as "their Gospel edition". Therefore Muhammad might have heard them talk about or might even have seen "the Gospel" (singular), since it was one continuous Gospel, though it contained all the material from the four original canonical gospels.
The information about this "Diatessaron" Gospel I gave you above is historical and true. Whether it is the one the Christians around Muhammad used, that is an educated guess with some good probability, but it is a guess only. The Qur'an doesn't tell us much about it, so we will forever be guessing. But, I think it is a good guess that makes the most sense of all the data we have.
Now back to the first question. What about the other gospels? For that I would ask you to read in another article on the The history of the Gospels
But there is another question one might ask back in return.
In the Qur'an, the story of Iblis' refusal to bow down to Adam is reported seven times, the story of Adam, the story of Lot, the story of Noah are all reported at least 3 times. If you don't find this strange and can accept that they do have all different details, but nevertheless are all true and from God, then why should God not be just as able to relate the story of Jesus through four different writers, commissioned by him to write it down, in harmony, all reports being true, even though each reports from a slightly different perspective?
Overview on the questions panel
Answering Islam home page.