In short, it was logically impossible for Jesus to sin. Jesus is able to be sinless because although the Bible teaches that everyone has sinned (Rom. 3:23), sin is not necessary. Recall the possibility of a world that does and does not have sin (used in the problem of evil):
There is a possible world in which all free creatures willingly and freely choose to do right.
There is a possible world in which all free creatures willingly and freely choose to do evil.
Thus it is possible that every world God could create containing free creatures would be a world with sin and evil.
This does not mean that Jesus is created (outside of the biological human complexity that exists in the physical body). This is in relation to Jesus as a free agent, even more so due to humans having the notion permission. The two natures exist eternally and are not created. In this logic, we can see that human righteousness is not dependent upon sin (just as we have a rational soul in our human nature, we can choose to do right without necessity of wrong). So it is possible for Jesus to be genuinely tempted (in His human nature), while still maintaining His divine nature. Jesus’ human nature was able to feel the draw and lure of temptation but would not be able to sin because of His divine nature. God cannot feel the draw and lure of temptation, thus it was His human nature that was tempted. To sum this point up, righteousness is not contingent upon sin.