Where did God come from?
This question has to be evaluated on its merits and restated according to Islamic understandings.
First and foremost, Muslims do not compare Allah to His creation. Therefore, the question can be answered as such due to the fact that Allah is completely Exalted and far above mortal description; He is not “like” His creation.
Allah tells us in His Book that He is “As-Samad” (The eternally Besought of all). He is also the “Al-Awwal” (First) and the “Al-’Akhir” (Last) He is without beginning or end. This is how He always was and always is, and always will be, so to speak.
Second, Islam is clear on the issue of asking questions about Allah, warning people against being influenced by such question which could plant doubt into someone’s mind or drive him away from the Right Path.
Let us consider the Hadith of the Prophet (peace and blessings be upon him) wherein he mentioned that the Shaytan (Satan) will come to you and trouble you with questions like: “Who created this or that?” To which you would logically respond: “Allah.” Until he would come to the question: “Then who created Allah?” At which point the Prophet (peace and blessings be upon him) instructed us to say: “I seek refuge in Allah from the accursed devil.” And then leave off this train of thought. (Reported by Muslim)
You might also consider similar questions that the enemies of Islam have used for centuries to weaken one’s faith in the existence of Allah.
When the disbelievers come to you and ask you if you believe in God, you would logically reply: “Yes.”
Then they would ask you: “Can your God do anything?” You would say: “Yes.”
Then they would ask you: “Can your God make something huge?” You would say: “Of course.”
They would say: “Can your God make something so big that nothing can move it?” Then you would say: “Yes.”
Then they would say: “You mean that your God could make something so big that nothing could ever move it?” Again, you say: “Yes.”
Then they say: “So big that even your God can’t move it?” Now you have a problem.
Either you answer: “Yes.” They will say: “Then that means your God cannot do everything. Because now there is something that your God cannot do. He cannot move the object.”
But if you answer: “No.” They will simply say: “Then this is something that your God cannot do.”
This is a similar problem to the one you have mentioned. This is the idea of a god that is having problems with his own creation. The concept of Allah in Islam is that He is never compared to His creation. He merely says: “Be.” And it is. So, Allah does not operate like a human or anyone or anything within His creation. Within the laws of creation is the rule that nothing moves except that there is a fulcrum, a lever and a force. Allah does not have to use a fulcrum and lever to move anything. One of His attributes is that He is “Al-Qawiyy” (The All Powerful).
So, He is the Power. He does not come under the rules of His creation. He makes the rules. He operates within His own rules; He changes His rules as He pleases, and according to the way He deems fit. That is the understanding of the Muslims.
For further reading on this and other important subjects on Islam, please refer to books on `Aqeedah (Muslim Creed), Tawheed (Monotheism) and other Islamic Beliefs by: Dr. Abu Ameenah Bilal Phillips; Dr. Jafar Sheikh Idris; Jamaludeen Zarabozo; Ali Tamimi, and others.”