I have been reading the Quran recently and it talks about how a trumpet will be sounded to denote the end of times. This parallels with the Christian book of Revelations, where 7 trumpets will be sounded during the end of times. My question is if Muslims do not believe that the book of Revelations is one of the four canonical scriptures (Torah, Psalm, Gospel, Qur'an), why is the mention of trumpets in both Revelations and the Qur'an?
It's not so much that Muslims believe the Book of Revelations isn't a canonical scripture, rather it's not identified in the Qur'an as a canonical scripture. Muslims do believe in revelation outside of the four books, but without confirmation of it's revelatory status (e.g. explicit mention in the Qur'an) we just have no way to discern whether it's authentic or not. As the Prophet is reported to have said:
Do not believe the people of the Book, nor disbelieve them... [Bukhari]
In general, if something — be it Biblical, traditional or other — is confirmed through Qur'an and/or hadith, it is accepted as valid, but that doesn't necessarily mean anything about other elements in the same book, chapter or even verse.
So even if the Book of Revelations relied on actual divine revelation to know that trumpets would be used to denote the end of times, that doesn't necessarily mean that the rest of Revelations is also divinely revealed. But it also doesn't mean it wasn't. We just don't know.
Just because a text agrees with the Quran does not imply that it was divinely revealed. The Book of Revelations may have sourced its content from other divine scriptures and the traditions passed on from the true prophets. It is not the first book to refer to the Trumpet, rather it is also alluded to in Isaiah 27:13 and Matthew 24:31.