Praise be to Allah.
What was the first thing Allah created?
These hadiths are in harmony with one another; they do not contradict one another. The first thing that Allah created of the things that are known to us was His Throne , which He rose over after He created the heavens, as Allah says (interpretation of the meaning):
“And He it is Who has created the heavens and the earth in six Days and His Throne was on the water, that He might try you, which of you is the best in deeds” [Hud 11:7]
Was the Pen the first thing to be created?
With regard to the Pen, there is nothing in the hadith to indicate that the Pen was the first thing created. What the hadith means is that when Allah created the Pen, He commanded it to write, so it wrote down the decrees of all things.
Was Prophet Muhammad the first to be created?
With regard to Prophet Muhammad (peace and blessings of Allah be upon him), like all other human beings, he was created from the water (semen) of his father, ‘Abd-Allah ibn ‘Abd al-Muttalib. He is no different from other human beings in the manner in which he was created, as he said about himself, “I am a human being, I forget as you forget.” He (peace and blessings of Allah be upon him) felt fear, got thirsty, felt cold, suffered from the heat, got sick and died. Everything that humans go through as a part of human nature, he also went through, but he is distinguished by the fact that he received Revelation and he was qualified to bear the Message, as Allah says (interpretation of the meaning):
“Allah knows best with whom to place His Message.” [al-An’am 6:124]
And Allah knows best.