Al-Khidhr (AS) was one of the sincere servants of Allah (SWT) who was
been granted by Allah (SWT) His direct knowledge علم لدني (surah 18 verse 65).
Al-Khidhr (AS) was more knowledgeable than Prophet Moosa (AS) in few
matters and not in every matter. The Divine Wisdom is best known by
Allah (SWT). Some of the Ulama say that it might be a procedure to
train Prophet Moosa to be more patient and to teach the believer in
all the ages to be patient and to seek more knowledge and not to
object before having full knowledge about the situation. After all,
Allah (SWT) knows the best of the Divine Wisdom as we believe that He
is the Absolute Wise and Merciful who knows everything in the past,
present and the future, that is why we firmly believe in His divine wisdom best known to Him and His messenger and the his Infallible successors.