In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear questioner, we would like to thank you for the great confidence you place in us, and we implore Allah Almighty to help us serve His cause and render our work for His Sake.
Answering your question, Dr. Muhammad Salama, PhD, Islamic Studies in English, Associate Professor at the Faculty of Islamic Sciences al-Madinah International University (Mediu), states:
These are good feelings from you and they reveal you kindhearted nature.
Allah is the name of the Creator of this universe and its real God. This marvelous universe must have a creator and originator. No one has ever claimed to be such Creator and Originator except Allah Almighty and He has provided the evidence for that. The Creator and Originator is also the All-Sustainer and the One who manages the affairs of the created beings. Thus, He must also be the real God who alone deserves worship and devotion. How then dare people worship other gods!
Though there are people who do not believe in Allah, still, out of His Mercy and Grace, He provides for them and lets them enjoy this life. This, of course, does not mean that He is pleased with them. He is All-Knowing and All-Wise and manages the affairs of this world according to His Knowledge and His Wisdom, which are beyond human knowledge and wisdom.
In the Quran we read, “Yet whenever harm strikes you at sea, all that you [used to] call upon [in worship] vanishes [from your hearts]- except for Him [alone]. Then when He delivers you to [dry] land, you turn away [from worshipping Him alone]. For the human being is an [unbelieving] ingrate.” (Al-Israa’ 17:67)
In another place we read, “Say [to them]: Who is it that delivers you from the [veils of] darkness of land and sea? You call upon Him imploringly and inwardly: If He delivers us from this [peril], we shall most surely be of those who are ever-thankful! Say [to them]: God delivers you from this and from every anguish! Yet [still] you associate [gods with Him]. (Al-An`am 6:63-64)
These and other similar verses indicate that Allah the Almighty may answer the prayers of a non-Muslim in some cases and situations and for some reasons as mentioned in these verses.
In a prophetic statement, the Messenger of Allah (peace and blessings be upon him) said, “Beware of the prayer of a wronged person, even if he be a disbeliever, for there is no barrier before it [to reach Allah the Almighty].” (Ahmad) This is another reason to answer the prayer of a disbeliever.
However, once again, answering a prayer of a person does not necessarily mean that Allah loves this person or is pleased with him. Allah does not love those who are sinful or those who disbelieve in Him. Nevertheless, He may answer their prayers to gain some worldly interests or avoid worldly harms, out of His All-Encompassing Mercy and Justice. Allah gives worldly gains for both those whom He loves and those whom He does no love, but gives the reward of the Hereafter only for those whom He loves.
May Allah guide you to His religion.
Allah Almighty knows best.