John Owen's book "The Doctrine of Justification by Faith Through the Imputation of the Righteousness of Christ" is absolutely masterful. Every sentence is thoughtful and valuable.
In his chapter about the active obedience of Christ, he says some important things. Jesus didn't obey the law to become qualified to be our representative- He was our righteous representative by virtue of the incarnation (God taking on human likeness). He didn't become righteous by obeying the Law, He already was. He obeyed the law in our stead to "fulfill all righteousness" and be our surety. I know, that's deep stuff. Owen is way deep.
I want to share something Owen wrote on this subject I found especially edifying-
"He (Christ) became man for the church, namely, to become thereby the surety of the covenant, and representative of the whole...He was born to us, and given to us, lived for us, and died for us, obeyed for us, and suffered for us; that by the obedience of one many might be made righteous. This was the grace of our Lord Jesus Christ; and this is the faith of the catholic church. And what he did for us, is imputed unto us. This is included in the very notion of his doing it for us, which cannot be spoken in any sense, unless that which he so did, be imputed unto us."
Owen then gives a very poignant pastoral exhortation about the importance of Christ's obedience imputed to believers (somewhat unusual in a doctrinal treatise)-
"And I think men ought to be wary, that they do not by distinctions and studied evasions, for the defense of their own private opinions, shake the foundations of christian religion. And I am sure it will be easier for them, as it is in the Proverb, to wrest the club out of the hand of Hercules, then to dispossess the minds of true believers of this persuasion; that what the Lord Christ did in obedience unto God according unto the law, he designed in his love and grace to do it for them."
Wow! I can't tell you how much Owen's insights on this topic bless me.