Think about it. You, an imperfect being, love your son. Sometimes you even mess that up, but because you are who you are - not because you stop loving your son.
God also loved His son, a part of Himself that chose to be found in every respect just like every other man - with one exception: who he was. Becoming a man changed the power at his disposal, changed the way he saw things (new perspective - from inside human skin), and changed the way he he had to operate among men so that his example meant and counted for something special. But becoming human did not change who he was. Jesus could still say, "I am that I am" just like the Father could, because he was still, in who he was, God - even though he gave up practically everything else that we think of God being and being able to do.
In a very limited way, it is kind of like Bill Gates becoming a pauper. Bill would be just as penniless as any other poverty-stricken person, but there would still be something different about Bill - who he was as a person. Bill the person would still have the entrepreneurial spirit that got him into that group with Steve Jobs and the others in college. And he would still have that internal drive that took him from a kid on student loans to having more money than the banks who make those loans. He would be poor, at least for a while, but he would never stop being Bill Gates. If he wanted to regain the power and prestige and perks of being the founder of a Microsoft empire, he would have to do again what he did back when he was first trying to design a PC in his parents' garage.
That is, in a very limited way, what Jesus did. Why did he not sin, if he was just like you and me (who definitely have, and sometimes still do, sin)? Because of who he was Jesus did not sin - for even while fully man, he was still God who became man - with the same drives and will and love and mercy and sense of right and wrong and so on that makes God who He is. Jesus could do what we cannot because in the end, whether in heaven on a throne or on earth in human flesh, he was still God at the very core of his being. Living according to his Father's will was living according to his own will. He could do what his Father wanted perfectly because his Father's sense of perfection and will for mankind was still in the make-up of who he was without omniscience and without omnipresence and without being omnipotent while in the flesh. Whi he is and was while on Earth are the same as who he was and ever will be while in heaven. What changed was the packaging and the power, NOT the identity and sense of self.
This is why when we come to Christ, the more we self-identify with Him, the easier it is to see temptation for what it really is and resist it...even for us! It is transforming and progressive and so powerful it can take a murderous hater of disciples of Jesus and transform him into an amazing missionary and evangelist of God's power in Christ through the speaking and living of the gospel to the Gentiles.
He transformed Paul and all the other apostles and disciples we read about in the NT, just the same as He has been transforming you and me. We sin because we self-identify (deservedly) as sinners. He did not sin because he self-identified completely with God.
I hope that helps.