In the Quran there are sunrise and sunset and also moonrise and moonset.
Quran 55.17 Lord of the two risings and Lord of the two settings.
So there are two risings and two settings. There are two risings, rising of the sun and rising of the moon. And there are also two settings, setting of the sun and setting of the moon. So the Quran has to specify what is setting because there are two settings. When it starts getting dark you have to specify that this is setting of the sun, because the other setting, setting of the moon, doesn't trigger darkness. So Quran 18:86 is specifying what is setting, setting of the sun. This is not a location. So Thu-Alkarnain himself was in a muddy spring at the time of sunset. The sun setting in a muddy spring is just a mistranslation.
There are also other grammatical mistakes made by the translators.
"Hatta in Arabic حتى" means "until" and is always coupled with time (not location). The word that does refer to location is "ila الى" which means "to" and is always coupled with a location. For example, "the boy went to school ذهب الولد الى المدرسه". You cannot say in Arabic "the boy went until school ذهب الولد حتىالمدرسه" because "until حتى" only refers to time. So in Arabic "until حتى" is always followed by time. If the verse "setting of the sun مغرب الشمس" is a location as skeptics claim then it should have been preceded by "to الى" and the verse should have read "الى ان بلغ مغرب الشمس" in that case the verse indeed would have meant the setting "place" of the sun; however this wasn't the case. The verse started with "until حتى" which only refers to time "حتى إذا بلغ مغرب الشمس". So "setting of the sun مغرب الشمس" is time of sunset (not a location). However it was mistranslated to the "setting place of the sun". The word "place" was added by translators.
In Arabic grammar all places and locations are referred to in the male mode. For example, "هاذا المكان"... Since the setting place of the sun is a location then it should also be referred to in the male mode however this was not the case. This verse ends with female mode: "he found at it people وجدعندها قوما" here "it ها" the Arabic is in the female mode; which means it refers to the muddy spring (عين حمئة female mode) and not to the "setting place of the sun" (male mode).
So both "until حتى" at the beginning of the verse and the female mode at the end prove that the translation was wrong.
Quran 18.86 simply says that Thu Al-Qarnain continued moving until time of sunset, while setting he (and his army) were in a muddy spring and there he found people...
So the sun setting in a muddy spring is just a mistranslation. Other mistranslations in the same story of Thu Al-Qarnein are Asbab اسباب in Arabic means directions. Your index finger in Arabic is called Sabbaba سبابة because it points to directions but still this word was mistranslated to other languages. Another word "saddain" in Arabic means "two dams" however it was mistranslated to other languages as "two mountains". Another word "sadafain" in Arabic means "two shells" also was mistranslated to the exact same words "two mountains". This suggests that translators were translating the Tafseer, not the original Quran.
The frequent mistranslation of the Quran presents wrong stories in other languages. Please always refer to Arabic Quran.