Cortes was an opportunistic lawyer/notary he had no military experience before the conquest of Mexico and I’m not sure there is any evidence that he had any military education.
Yeah he turned out to be a fairly competent commander but it was main his diplomatic skill that allowed him to conquer Mexico. There is no way he would have won without the tens of thousands of native allies that fought alongside the Spanish.
Also his dad was an infantry captain. And he seemed to be commanding his armies, and armies of allied tribes
https://en.wikipedia.org/wiki/Battle_of_Otumba