When Jesus was in the desert and the devil tempted him to turn a rock into a piece of bread because he was hungry, why would that have been a sin since Jesus was hungry?
Because the Father’s will was that He fast at that time.
It would mean that the divine was bowing to the lead of evil which is what the devil really wanted. Remember, the devil didn’t really care about Jesus’ hunger. It wasn’t really about bread any more than the garden of Eden episode was really about a piece of fruit.
To answer your question: because the Father’s Will was for the Son to fast.
I’ve heard a great interpretation if this narrative that goes something like this: the temptations are actually more than what they appear to be on the surface; they’re representations of the types of Messiah Christ could have been. The “turn stones to bread” one represents a miracle-working Messiah: one who convinces people to believe by constant miracles rather than rely on their faith. The “angels will catch you” one represents a Messiah who is protected from suffering on the Cross by the angels. The “bow to me, and you’ll rule the world” one represents a conquering Messiah, like the Jews wanted: a Messiah who conquers and rules the world by force rather than love and mercy.
Jesus refused all these, though, because He knew His destiny: to be a suffering Messiah, one who, out of infinite love, allows Himself to die in excruciating pain so that His people might live in infinite joy.
As Pope Benedict elaborates on in his Jesus of Nazareth series, the temptation is indeed more than meets the eye. It’s a temptation to abandon his mission to die for the sins of the world and instead just become one who solves earthly problems without addressing the spiritual need.