Do you want the closest factual theory or religious people rationalizing their viewpoint?
Islam, like Judaism and Christianity has had a policy of tweaking their origins of polytheistic past by either burying the information or obscuring as much as possible. Muhammad's religion, pre-revelation of Gabriel was an alleged pagan with some Christian relatives(nestorian or some early sect - not organized and as dogmatic as the Catholic Church or any branch of Orthodox), and lived in proximity to Arabian Jews. A lot of the Quran that is a retread of the early bible and torah was either tweaked intentionally by Muhammad or tweaked by the process of telephone as each source in a chain tweaks it a bit. At the time of Arabia when Muhammad was alive, a big contention was the fact that the arabians had like 300+ gods. Some of those gods include names like Allah(even back in polytheist days, Allah was #1 god for people in Quraysh, Muhammad's birthplace),Al-uzza and many more. Muhammad has his revelation from an Angel and does a mass conversion from Paganism to Monotheism.
Yet, as we all know... change is hard for some people and old habits die hard. They started converting all the pagan activities to monotheistic ones. The Kabba which had all of these god statues(300+) were shattered, the rituals of mass migration to mecca for pagans and their multiple gods were changed to be about Muhammad and Allah instead, and Muhammad started preaching that Allah was the one and only god to the former pagans.
Don't take this as me hating on muslims - it's all abrahamic religions that retcon themselves. Caananites had multiple gods like Baal, El and bushed them to promote yahweh as being the only god. Romans turned Saturnalia into Christmas.