Praise be to Allah, and may peace and blessings be upon the Messenger of Allah. To proceed:
The texts of the Qur’an and Sunnah indicate that people on the Day of Resurrection will be divided into two groups regarding the receiving of their books: the people of faith will receive their books in their right hands, while the people of disbelief will receive them in their left hands or from behind their backs.
The stronger view is that a Muslim who dies upon monotheism will receive his book in his right hand, even if he committed major sins, because receiving the book in the right hand does not necessarily mean that he will not be punished for his sins. As for the one who receives his book in his left hand, he is the disbeliever who died upon disbelief.
Allah تعالى says:
“As for the one who is given his book in his right hand, he will be given an easy reckoning, and he will return to his people joyful.” [Al-Inshiqaq: 7–9]
The believer therefore rejoices when receiving his book in his right hand because he knows that he is among the people of monotheism and that his ultimate destination is Paradise, even though he may deserve punishment for some of his sins.
Therefore, a sinful Muslim may pass through different stages: he rejoices when receiving his book in his right hand, then becomes sad if he is punished for his sins, and then rejoices at entering Paradise through the mercy of Allah.
As for the people of faith and piety who do not deserve punishment, their joy will be greater and more complete, and their joy will not be followed by such sorrow and punishment.
Likewise, the people of Paradise themselves differ in their ranks and happiness according to their deeds and the bounty of Allah upon them.
Accordingly, there is no contradiction between a sinful Muslim receiving his book in his right hand and entering Hell because of his sins. This is because receiving the book in the right hand indicates his faith and his ultimate salvation; it does not mean that he will not be punished for whatever sins Allah wills him to be punished for.
And Allah knows best.