Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:17:83

And when We bestow favor upon the disbeliever, he turns away and distances himself; and when evil touches him, he is ever despairing.  

And when We are gracious to man, the disbelieving ˹man˺, he is disregardful, of giving thanks, and turns aside, turning his face away in arrogance; but when an ill, such as poverty or hardship, befalls him, he is in despair, despondent of God’s mercy.
القرآن:١٧:٨٣

وَإِذَا أَنْعَمْنَا عَلَى الْإِنْسَانِ أَعْرَضَ وَنَأَىٰ بِجَانِبِهِ ۖ وَإِذَا مَسَّهُ الشَّرُّ كَانَ يَئُوسًا  

{وإذا أنعمنا على الإنسان} الكافر {أعرض} عن الشكر {ونأى بجانبه} ثنى عطفه متبخترا {وإذا مسه الشر} الفقر والشدة {كان يؤوسا} قنوطا من رحمة الله.

See similar narrations below:

Collected by Qurʾān
quran:41:51

And when We bestow favor upon man, he turns away and distances himself; but when evil touches him, then he is full of extensive supplication.  

And when We bestow graces upon man (insān, the generic noun ˹is meant˺), he shows disregard, of giving thanks, and turns aside, turns his head in arrogance (a variant reading ˹for nā’a˺ has na’ā); but when ill befalls him, he makes prolonged supplications.
القرآن:٤١:٥١

وَإِذَا أَنْعَمْنَا عَلَى الْإِنْسَانِ أَعْرَضَ وَنَأَىٰ بِجَانِبِهِ وَإِذَا مَسَّهُ الشَّرُّ فَذُو دُعَاءٍ عَرِيضٍ  

{وإذا أنعمنا على الإنسان} الجنس {أعرض} عن الشكر {وناء بجانبه} ثنى عطفه متبختراً، وفي قراءة بتقديم الهمزة {وإذا مسه الشر فذو دعاءٍ عريض} كثير.