While it is the verdict of the Holy Qur’an that polytheists are Najas or “impure”, they are only forbidden from approaching the Sacred Mosque in Mecca because of its special sanctity:
يَا أَيُّهَا الَّذِينَ آمَنُوا إِنَّمَا الْمُشْرِكُونَ نَجَسٌ فَلَا يَقْرَبُوا الْمَسْجِدَ الْحَرَامَ بَعْدَ عَامِهِمْ هَـٰذَا
O you who believe! Verily the Polytheists are impure, so let them not approach the Sacred Mosque after this year of theirs (9:28)
The Holy Qur’an singles out the Sacred Mosque in Mecca as off-limits to the polytheists but no other Mosque. But as for other mosques: the Prophet (peace and blessings of Allaah be upon him) tied up his prisoner Thamaamah ibn Athaal al-Hanafi in the mosque before he became Muslim, and the delegations of Thaqeef and the Christians of Najraan stayed in the mosque before they became Muslim. There were many benefits offered by doing this: they could hear the speeches and sermons of the Prophet (peace and blessings of Allaah be upon him), see people praying and reciting Qur’aan, and other benefits that are gained by those who visit the mosque. Hence it is proven from the Sunnah that there is no prohibition on non-Muslims entering a mosque in general.
Now an elder of the rigid Deobandi sect, Ashraf Ali Thanwi, issued a Fatwa forbidding Hindus from entering a mosque. But what is really surprising is one of the reasons Ashraf Thanwi gave for this edict:
Translation: “One of the major reasons for preventing Hindus from entering a Mosque is that they do not allow Muslims to go inside Mandirs [Hindu temples]; so the jealousy for Islam should be a reason to likewise prevent Hindus from entering into a Mosque.”
Reference: Imdadul Fatawa; v. 2, p. 692
In other words, Ashraf Thanwi believes that because Hindus forbid Muslims from entering into a Hindu temple, Muslims, out of jealousy for the respect of Islam, should pay them back in their own coin and prevent them from entering a mosque. Why this “fatwa” is so problematic should be obvious to any ordinary Muslim. Hindu temples are places of idolatry, inhabited by idols and forbidden images of false “gods”. As such, Muslims are not allowed to enter into a Hindu temple, even if the Hindus welcomed them:
It was narrated from Ibn ‘Abbaas (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) saw images in the Ka’bah and he did not enter until he had ordered that they be erased. Narrated by al-Bukhaari (3352).
If the Prophet ﷺ did not even enter the sacred Ka’ba, the holiest place on Earth, until it had been cleansed from idols, how can it be possible for Muslims to enter into a Hindu temple?