I may be wrong but even the prophet himself was surrounded by people who had deep knowledge of other religions, Christianity and Judaism. It was completely possible that this information was simply given to him. It’s the same stories circling all Abrahamic faiths.