He said, "My Lord, how will I have a boy when I have reached old age and my wife is barren?" He [the angel] said, "Such is Allāh; He does what He wills."
The Supplication of Zakariyya, and the Good News of Yahya's Birth
When Zakariyya saw that Allah provided sustenance for Maryam by giving her the fruits of winter in summer and the fruits of summer in winter, he was eager to have a child of his own. By then, Zakariyya had become an old man, his bones feeble and his head full of gray hair. His wife was an old women who was barren. Yet, he still supplicated to Allah and called Him in secret,
رَبِّ هَبْ لِى مِن لَّدُنْكَ
(O my Lord! Grant me from Ladunka,) from You,
ذُرِّيَّةً طَيِّبَةً
(A good offspring) meaning, a righteous offspring,
إِنَّكَ سَمِيعُ الدُّعَآءِ
(You are indeed the All-Hearer of invocation.) Allah said,
We have already seen that Sayyidna Zakariyya (علیہ السلام) believed in the absolute power of Allah and had seen its manifestation repeatedly and that he had himself made the prayer and knew of its acceptance as well, what then, did he mean by asking: 'how shall I have a boy?' The truth of the matter is that the question asked by him was not be-cause of any doubt in the absolute power of Allah. Quite contrary to this, the purpose of the question was to find out the state in which this was to happen: whether the present extreme old age of both of them would remain just as it was, or would that state be changed. The eloquent reply given in كَذَٰلِكَ اللَّـهُ يَفْعَلُ مَا يَشَاءُ (That is how Allah does what He wills) makes it clear that they were to remain at the same age and that they would have an offspring in that very state. This resolves any doubt that may be entertained at this point. (Bayn al-Qur'n)
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 32–43
It is a psychological reality that one who loves someone cannot at the same time love the enemy of the beloved. It is also a fact that when the beloved is a Being who has the status of one’s Creator and Sustainer, then this love will necessarily bring about in the lover the desire to obey that Being in all matters. If the love of God does not produce in him feelings of obeisance to Him, then such a love is false. A believer who is one in name only will be included among the deniers. God Himself has testified to the Prophet’s total obedience to Him in all matters. So the authentic example of a life of God-worship in this world is only such as was handed down to us by His messenger.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.