Jesus
Why was Jesus tempted if he is God?
Hebrews explains this directly: Jesus was tempted so that he could become a sympathetic high priest, one able to genuinely understand human weakness because he actually experienced it—not a distant figure who only knows about temptation abstractly.
This connects to his full, genuine human nature: temptation is a real feature of human experience, and Jesus lived a real human life, including facing hunger, isolation, and pressure in the wilderness, and later intense anguish before his crucifixion. His divine nature didn't cancel out his human experience of these pressures.
Whether Jesus' temptation carried a genuine possibility of failure is a separate, more technical theological question Christians debate. What all Christian views agree on is the purpose stated in Hebrews: real temptation, faced and overcome, so that Jesus could offer genuine solidarity and help to people who struggle with temptation themselves.
Bible quotations in these answers are generally taken from the Christian Standard Bible®, Copyright © 2017 by Holman Bible Publishers. Used by permission. Christian Standard Bible® and CSB® are federally registered trademarks of Holman Bible Publishers. Some biblical wording may be paraphrased or follow other translations.