All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The Decree is the secret of Allah in his creation. Refraining from thinking about its details is more appropriate for a rational person. It is enough for the believer to confess what is proven in the Book and the Sunnah, which is the doctrine of Ahlus Sunnah wal-Jamaa’ah, that there is nothing that happens in the Kingdom of Allah except by His Will, and no incident takes place except with His Permission.
There is absolutely nothing in the entities of the slaves and their deeds except that Allah created them. He is the One Who Created the slaves and their actions. It is He who misguides whomever He wishes and guides whomever He wishes.
Misguiding whomever He wishes, is by creating the will of misguidance in his heart. Guiding whomever He wishes, is by creating the will of guidance in his heart. Despite this fact, Allah, Exalted be He, did not compel anyone to do any particular deed; rather, He created a will in the slaves by which their actions happen. Allah is really the One Who guides and Who misguides; and the slave is really the one who is guided and misguided. The slaves do not have any argumentation against Allah, but Allah has the far-reaching argument. Allah had sent Messengers, revealed Books and did not leave any room for excuses. The slave is guided or misguided with his own will, and he is held accountable for the act that he does with his own will without being compelled by anyone.
Every sane person distinguishes between a compelling act, such as the beat of the heart and so on, and a voluntary act, such as standing for the prayer and the like, even though all of this happens according to Allah’s Will and Creation.
The slaves are held accountable for the acts they have done by their own choice and their own will.
For more benefit, you may refer to the Book al-Qadhaa’ wal-Qadar authored by Dr. Omar Al-Ashqar (may Allaah have mercy on him), and read the dissertation of Ibn 'Uthaymeen about Al-Qadar (Decree) with some attentiveness, and you will get rid of confusions in this subject, provided that you do not think too much about this meticulous subject and not indulge in it.
Rather, act according to the obedience of Allah as much as you are able to, avoid disobeying Him and hope for His Mercy. This is the way for salvation.
For more benefit, please refer to Fataawa 286615, 363415, 55820, 85447, and 90421.
Allah knows best.