Hebrews 5:8 though He was a Son, yet He learned obedience by the things which He suffered.
Even though Jesus was (and is) the Son of God and was always obedient to Him, He also showed that He was obedient to His own suffering and death on the cross.
It was well within His power to end the suffering, skip the death and still be with God in heaven, but He chose to not ignore all those terrible things and suffer them for our cause.
This was a voluntary step He took forward on our behalf to prove His love for us and to prove the Father’s love for us by giving us eternal hope, peace and life with Him. We are not exempt from suffering either!