If prophets are sinless, why do they ask for forgiveness?
Prophets do not commit sins in the ordinary sense. They ask for forgiveness because they measure themselves against God’s perfection, and before Him even the best of people seem imperfect.
Sin is a term that depends on the standard being applied. What counts as a fault for one person in his situation may count as a shortcoming for another who stands at a higher level. Upbringing, knowledge and inner refinement all shape what a person feels to be a failing.
When we say that prophets do not sin, we mean sin in the ordinary sense. They do not break God’s commandments. Yet a refined person is often ashamed of a small imperfection that is a fault only by his own lofty standard. He feels more ashamed of it than many others feel about a serious wrong.
We know this from everyday life. Some people apologise for things where we see no reason for an apology at all. Still it troubles them, because they feel they have fallen short. That is not a sign of a bad character but of a noble one.
This is how it is with the prophets. Before people they stand pure. But before God, whose perfection has no limits, no one is without shortcoming in this sense, not even Jesus (as). The closer a person is to God, the more clearly he sees the distance between himself and Him. The verses above and the words of the Holy Prophet Muhammad (saw) reflect exactly this attitude.
If we look at the prophets from the side of people, we see their purity. If we understand them from the side of God, we see their humility. Their asking for forgiveness is therefore not a confession of sins but an expression of their greatness.