Hadith: When a disbeliever does a good deed, he is rewarded for it in this world. As to the believer, Allah, the Almighty, saves his good deeds to reward him in the Hereafter and provides him with sustenance in this life as a reward for his obedience
عن أنس بن مالك رضي الله عنه مرفوعاً: «إنَّ الكافر إذا عمل حسنة، أُطْعِمَ بها طُعْمَةً من الدنيا، وأما المؤمن فإِنَّ اللهَ تعالى يدخر له حسناته في الآخرة، ويُعْقِبُهُ رزقًا في الدنيا على طاعته».
وفي رواية:«إنَّ الله لا يظلم مؤمنا حسنة، يُعْطَى بها في الدنيا، ويُجْزَى بها في الآخرة، وأما الكافر فَيُطْعَمُ بحسنات ما عمل لله تعالى في الدنيا، حتى إذا أفضى إلى الآخرة، لم يكن له حسنة يُجْزَى بها». [صحيح] - [رواه مسلم] المزيــد ...
Anas ibn Mālik (may Allah be pleased with him) reported that the Prophet (may Allah's peace and blessings be upon him) said: "When a disbeliever does a good deed, he is rewarded for it in this world. As to the believer, Allah, the Almighty, saves his good deeds to reward him in the Hereafter and provides him with sustenance in this life as a reward for his obedience."
Another narration reads: "Allah does not deal unjustly with a believer regarding a single good deed. He is given blessings for it in this world and will be rewarded for it in the Hereafter. As to the disbeliever, he is given sustenance as a reward for his good deeds in this world, so when he comes to the Hereafter, there are no more good deeds for him for which he can be rewarded.” Sahih/Authentic. - [Muslim]
If a disbeliever does an act of obedience, then Allah, the Almighty, will provide him with sustenance in this world in return for it. As for the believer, if he does an act of obedience, then Allah will save the reward to give it to him in the Hereafter as well as reward him for his obedience in this world.
Allah never misses rewarding the believer for his good deeds; He gives him reward in this world as well as the next. As to the disbeliever, he is only rewarded in this world for his good deeds, and when the Day of Judgment comes, he will have no good deeds to be rewarded for.
Scholars have agreed that if the disbeliever dies upon disbelief, then he will have no reward in the Hereafter, and he will not be rewarded for any of his good deeds performed in this world. This Hadīth clearly mentioned that the disbeliever will be fed and rewarded in this world for what he did of good deeds which do not require a sound intention to be accepted, such as maintaining ties of kinship, charity, freeing a slave, hosting guests, and similar deeds.
However, if the disbeliever does such good deeds then enters Islam, then he will be rewarded for them in the Hereafter, as indicated in the Hadīth: "You embraced Islam with all the previous good deeds you had performed.”