It is one of The Quran stories
Zul-qarnain are two words; the first one, which has many ways of writing, means to be associated with something, and the second one means the east and the west of the sun. The result is that the last character went to the west and the east of the earth.
Qur’an mentioned Thul-Qarnain in AL-Kahf Surah. Allah said” They ask thee concerning Zul-qarnain. Say, “I will rehearse to you something of his story.” {Verse 83}
The last verse told that the people of the scriptures asked the Prophet Mohammad to tell them about that character.
“Verily We established his power on earth, and We gave him the ways and the means to all ends.” {Al-Kahf. 84}
Allah the Almighty gave him ability and power to influence the countries of the earth and obey them.
God gave him the reasons that lead him to be arrived to what he used to help him to conquer the countries, and easy access to the ends of the construction, and he acted with those reasons.
He has a great army, with a large number, equipment and order, and with all of that, he was able to conquer the enemies and facilitate access to the east, west, and parts of the earth. God gave him what he made him reached the setting of the sun, until he saw the sun in the sight of the eye, as if it was setting in “murky water” which means Black, and this is the norm for the one who had water between him and the western horizon of the sun, so he saw the sun went down in the same water, even if it was very high, and found it, that is, there are people at its setting. “Until, when he reached the setting of the sun, he found it set in a spring of murky water: Near it he found a People: We said: “O Zul-qarnain! (thou hast authority,) either to punish them, or to treat them with kindness.” {Al-Kahf.86}
But because of his justice, he divided the people into two parts: the unjust people and they will be punished in this world and will be blamed on the Day of Resurrection. Unlike the believing, righteous people will have Paradise, and may they be treated with good treatment and kindness. “He said: “Whoever doth wrong, him shall we punish; then shall he be sent back to his Lord; and He will punish him with a punishment unheard-of (before)” {AL-Kahf.87}.”But whoever believes, and works righteousness,- he shall have a goodly reward, and easy will be his task as We order it by our Command.”{AL-Kahf.88}
Then he went to the dawn of the sun. Following the reasons that God gave him, he found people who didn’t not have a cover from the sun, either because they weren’t prepared in the dwellings, and their barbarity and brutality, or because the sun was permanent with them, and there wasn’t an enough set sunset, as it is found in eastern South Africa. All that happened thanks to Allah the Almighty who gave him the knowledge. “Until, when he came to the rising of the sun, he found it rising on a people for whom We had provided no covering protection against the sun.”{90} “(He left them) as they were: We completely understood what was before him.” {91} “Then followed he (another) way” {92}
“Until, when he reached (a tract) between two mountains, he found, beneath them, a people who scarcely understood a word” {93} “They said: “O Zul-qarnain! the Gog and Magog (People) do great mischief on earth: shall we then render thee tribute in order that thou mightest erect a barrier between us and them?” {94} “He said: “(The power) in which my Lord has established me is better (than tribute): Help me therefore with strength (and labour): I will erect a strong barrier between you and them:”
After that, He went on his way from the east, heading to the north, and reached a tract between two mountains which was a barrier between Gog and Magog and the people. Beneath that, he found a people who hardly comprehend the speech. Then he taught him so that they learned and understood him, so they can complained to him of the harm Gog and Magog and asked for protect. Their demand was to build a barrier for them to protect them from the danger of Gog and Magog. And they offered him a reward, but he built the barrier with the intention of reform and a reward from God, and he mentioned that Allah’s support for him is better than their reward.
Then he asked them to help him in building that barrier. “Bring me blocks of iron.” At length, when he had filled up the space between the two steep mountain-sides, He said, “Blow (with your bellows)” Then, when he had made it (red) as fire, he said: “Bring me, that I may pour over it, molten lead.”{96} “Thus were they made powerless to scale it or to dig through it.”{97}
Finally, he succeeded in building the strong and high barrier that the Gog and Magog were not able to come through. As soon as he succeeded in building the barrier, he thanked God and mentioned his bounty. This is the character of the righteous ruler.
References
islamweb.net قصة ذي القرنين كما وردت في سورة الكهف