Allah works the universe through His laws. Physical laws, psychological laws etc. We have free will to do whatever we want but our decisions and its consequences are governed by the laws that Allah has established. We get punished and rewarded according to these laws. The Quran was sent as a guidance to help us make the best of our decisions and reap the benefits.
[48:23] Such is God's way with those who have passed away before, and you will not find any change in God's way (sunnatullah).
I hope this makes sense.
Peace

__________________