As pointed out by others, there was a vote by the SNP membership, which he won, so he was elected, not to mention his constituency elected him their MSP.
One of his main opponents was Kate Forbes, who I have mentioned a couple of times. She was quite explicit, as borne out by some of her previous voting, that her Wee Free faith would inform her decision-making.
You keep, wrongly, calling Yousaf an "Islamist", so why not call Forbes a Christian Fundamanetalist Radical and be concerned about her? The Wee Frees not being representative of mainstream opinion - FFS, the first time I visited Lewis the Wee Frees still insisted on shutting absolutely everything down on a Sunday.