When Allah wants to guides anyone then Allah gives that person the wisdom and when Allah wants to misguide anyone then Allah takes away the wisdom from that person.
2:269 He (Allah) grants wisdom to whom He (Allah) chooses, and whoever is granted wisdom has been given much good. Only those who possess intelligence will remember.
BUT QUESTION IS WHY ALLAH GIVES/GRANT WISDOM TO ANYONE?
For this reason We have to understand why two magnet attracts opposite poles and repel the similar poles?
If person has the qualities which attracts Allah’s obedience then Allah guides that person after putting him/her in different tests and trails in life.
Qualities such as Love, Mercy, Patience, Thankfulness, kindness, Generous etc If person has the qualities which oppose Allah’s obedience then Allah misguide that person after giving him/her the chance to pass or fail tests and trails in life in life.
Qualities such as Hate, Cruelty, Impatience, Unthankful, unkind, unjust, Greed etc
HOW QURAN ATTRACTS/POSSESSES THE PEOPLE?
3:179 “Allah was not to leave the believers as they were without distinguishing the Bad from the Good…”
If we mix the pile of wood chips and iron bits together then it will be very difficult to separate the iron bit from the wooden chips but if we bring the Magnet closer to the mixture of wooden chips and iron bits then magnet will attract the iron bits because they have the property of ferrous metal.
Similarly the Quran attracts the believers who have their fitrah (Tendency to accept and follow the truth) intact and properties which are compatible with the Quran.