The Qur'an assumes a flat earth which has physical places into which the sun sets and rises from. Since the earth is a rotating sphere, the sun does not set in any particular place and you can never travel to "the spot" where the sun sets nor a place where it rises; the sun appears to set or rise on the horizon no matter where you are on the planet. In these verses, the author propagates a popular legend from the 7th century of a man named Dhu'l-Qarnayn who visits the places where the sun sets and rises; here he finds the sun going down into a muddy spring and later rising on a tribe with no coverings.
Till, when he reached the setting-place of the sun, he found it setting in a muddy spring, and found a people thereabout. We said: O Dhu'l-Qarneyn! Either punish or show them kindness.
Qur'an 18:86
Till, when he reached the rising-place of the sun, he found it rising on a people for whom We had appointed no shelter therefrom.
Qur'an 18:90
Some Muslim Apologists have come up with creative interpretations of these verses to say that Dhu'l-Qrnayn only traveled until he reached "the west" or to a spot "at the time" when the sun set and not the "place" where the sun set. Unfortunately, these alternative interpretations are severely undermined by the
context and Arabic words used in these verses, which instead point to a physical location. Again, we must ask why an all-knowing being would use such misleading verses that mimic the misconceptions and legends prevalent at the time if one of these alternative explanations is correct.