Hadith Q258

وَإِنَّمَا اغْتَسَلَ اسْتِرَاحَةً مِنَ الْغَمِّ الَّذِي أَصَابَهُ فِي الْإِغْمَاءِ لِيُخَفِّفَ بَدَنَهُ وَيَسْتَرِيحَ‏.‏
Rather, the Prophet ﷺ performed ghusl to find relief from the distress that befell him in a state of unconsciousness, so that his blessed body would become balanced and calm.
Hadith Reference صحيح ابن خزيمه / جماع أبواب غسل التطهير والاستحباب من غير فرض ولا إيجاب / Q258