Firstly the Qur’an does not say "Alexander the great" The Qu’ran only says Zul-Qarnain, which means the two-horned one or the King with Two Horn. Yusef Ali in his commentary states
2428. Literally, "the Two-horned One", the King with the Two Horns, or the Lord of the Two Epochs. Who was he? In what age, and where did he live? The Qur'an gives us no material on which we can base a positive answer. Nor is it necessary to find an answer, as the story is treated as a Parable. Popular opinion identifies Dhu al Qarnayn with Alexander the Great. An alternative suggestion is an ancient Persian King, or a prehistoric Himyarite King…. Dhu al Qarnayn was a most powerful king, but it was Allah, Who, in His universal Plan,
Zul Qarnain of the Qu'ran was not Alexander the great, and there is evidence to prove this, i will give some examples of Why Zul Qarnain of the Qu'ran is not Alexander the great
Example 1
Dhu’l-Qarnayn who is mentioned in the Qur’aan lived at the time of Ibraaheem (peace be upon him), and it is said that he became Muslim at the hands of Ibraaheem (peace be upon him), and he went on pilgrimage to the Ka’bah walking. The scholars differed concerning him, as to whether he was a Prophet or a righteous slave and just king, but they agree that he was a Muslim, a monotheist (believer in Tawheed) and one who was obedient to Allah
(www.islam-qa.com/index.php?ref=22029&ln=eng)
Example 2
Zul-Qarnain in the Qur’an belived in One God, He says in the Qu'ran "as for him who believes in (Allah’s Oneness) and works righteousness, he shall have the best reward (Paradise), and we (Zul-Qarnain) shall speak unto him mild words." (Surah 18:87). Alexander the great in history was famously a pagan, The encyclopaedia states
"Alexander eagerly assimilated the religious mysticism of the Nile and of Magian Persia. Not only did he protect these religions, but also as a sole ruler, he necessarily assumed the semidivine aspect of an Asian despot, wearing Persian attire at ceremonies and accepting prostration in his presence." Furthermore, "Alexander’s greatest work was the spread of Greek influence..."
SOURCE: Encyclopaedia Americana, Volume 1, page 540
Example 3
In the Qu’ran Zul Qarnain was offered money to help Gog and Magog but Zul Qarnain responded, "(the power) in which My Lord has established me Is better (than tribute.)" (Surah 18:95). So Zul Qarnain of the Qu’ran was not interested in material things. This is the opposite to Alexander the Great that we read in History
"In Susa and Persepolis his (Alexander’s) headlong pursuit won him the imperial treasure of some 180,000 talents in bullion and coin - so fabulous an amount that he demonetised the gold to equate it with the smaller Graeco-Macedonian silver coinage,"
SOURCE: Encyclopaedia Americana, Volume 1, page 540
Conclusion
Alexander the great in history was a pagan, who was influenced by Greek, Egyptian, Asian & Persian mythology, So he cannot be the same person in the Qu'ran because Zul Qarnain Belived in One God, Allah, and he was not a Pagan, he was a man of God.
Also Zul Qarnain in the Qu'ran was offered money to help bad people, and he rejected this, whereas Alexander the Great in history was reported to have been a very materialistic person. So Zul Carnain in the Qu'ran is not Alexander the Great Some Muslim commentators do say Zul-Qarnain was Alexander the great, but their opinions were based on rough information they had available to them at the time. And they only gave their opinions. Opinions are not considered Divine truth in Islam, so commentators are free to express their opinions, but they can be right and wrong.