From what I've read, it seems that the two leaders of a Roman Legion, the Legate and the Tribune, were not promoted soldiers but were instead appointed members of the aristocracy. This seems very counter-intuitive from a modern perspective. What qualifications would these men have aside from being from the right families?
First, some clarification: the legates were approved by the Senate but nominated by the commander (the Latin word means "the chosen"), who was usually the governor of a province with proconsular imperium. There were usually several legati, almost always of senatorial rank, and their precise jobs changed in time and according to circumstance. Caesar had as many as ten in Gaul, for instance. Sometimes they commanded forces (either legions or parts of legions) or oversaw specific tasks (like creating fleets or building bridges). In Caesar's Gallic Wars we see legates doing a number of different tasks, some with seemingly no experience and some with extensive military backgrounds. For instance, Quintus Cicero (the brother of the famous Marcus Tullius Cicero) was one of Caesar's legates and commanded legions in Gaul in Caesar's name. He had been a Propraetor in Asia for three years before this but did not, to my knowledge amass much military experience there. His appointment to Caesar's staff was likely political more than pragmatic. On the other hand, Titus Labienus was a legatus pro praetore for Caesar in Gaul and his right-hand man. He had several campaigns under his belt and though he played a little politics in 63 BCE as a Tribune of the Plebs, he was first and foremost a military man. He was an amazing officer and was the de facto commander of the legions in Gaul while Caesar was away back in Italy.
The system of the legati was thus both a means to distribute command into capable subunits, but also to provide an opportunity for young men of senatorial rank to gain valuable experience before assuming imperium themselves as praetors, propraetors, consuls, and then proconsular governors. How precisely the legates were used was up the discretion of each commander. Again, Caesar is useful to illustrate. In the first two years of the Gallic Wars, Caesar seems to have utilized his military tribunes to command individual legions (see BG II.26 for instance). After that, legates seem to become the default organ of command for the legions in Gaul when Caesar was not there personally. Even when he was there, very often legates (especially Labienus) commanded wings or assault forces during battles. I personally would argue that the role of legates was changing in the mid-1st century BCE at the expense of the military tribunes, but that's another topic.
Also, one final note: you are right that very often, Roman legions found themselves being commanded by men who did not have very much (if any experience). This is where the beauty of the Roman military system shows: no matter who commanded at the top level, the officers (either legates or tribuni militum or prefects or whatever) and, under them, the centurions made sure things got done when they needed to get done. The centurions were the backbone of any Roman army in any time period in any corner of the Empire. They were military men, almost always promoted from the ranks based on merit and grit rather than political favor. They were the NCOs of their time, the grizzled old-timers who kept their men trained, kept them fed, kept them in line, and kept them alive.
u/Alkibiades415 gives some good information on the appointment and use of legates in the later Roman republic, but I have to object to what he has to say afterwards:
The centurions were the backbone of any Roman army in any time period in any corner of the Empire. They were military men, almost always promoted from the ranks based on merit and grit rather than political favor. They were the NCOs of their time, the grizzled old-timers who kept their men trained, kept them fed, kept them in line, and kept them alive.
This is a persistent and popular way of describing the Roman Centurionate, but the evidence suggests otherwise.
Centurions in the Roman Republic
In the time of the middle Republic, the Centurion was no more professional than any other member of the army. The whole army consisted of citizens-under-arms, who would serve for the duration of a campaign (or later, a number of campaigns) and then return to civilian life.
Polybios tells us that the centurions at this time were elected by their own men, and that typically good and steady leaders were preferred. No doubt the average centurion was a cut above the average legionary militiaman of this time, but he would be as much a part-time soldier as any of them.
The Principes, Hastati, and Triarii, each elect ten centurions according to merit, and then a second ten each. All these sixty have the title of centurion alike, of whom the first man chosen is a member of the council of war. And they in their turn select a rear-rank officer each who is called optio. [...] And they wish the centurions not to be so much bold and adventurous, as men with a faculty for command, steady, and of a profound rather than a showy spirit; not prone to engage wantonly or be unnecessarily forward in giving battle; but such as in the face of superior numbers and overwhelming pressure will die in defence of their post. — Polybios, Histories, book 6
There is some evidence that there was an informal class of "military men" at this time, who sought out service in the legions and saw it as a career. These, however, would have included both tribunes and centurions, and it's unclear how many of these there were and how big a role they played.
Legates and generals in the Roman Republic
This is where the beauty of the Roman military system shows: no matter who commanded at the top level, the officers (either legates or tribuni militum or prefects or whatever) and, under them, the centurions made sure things got done when they needed to get done.
Again, this view is outdated. In ancient battles, the role of a commander was very important. It was the commander who decided when to fight, where to fight, how to fight. It was the commander who decided how to deploy his forces and what instructions to give to the officers. You can't compensate for that with good junior officers on the ground. Don't get me wrong: good junior officers were a very important component of the legions' success, but they fulfilled a role in addition to that of the overall commander. Even during the battle, Roman commanders took a very active role in overseeing the fighting. To be a Roman general was by no means a sinecure.
The typical Roman legate or general would be an amateur in just the same fashion as his soldiers. They had no formal training for command, and indeed sometimes were unsuited for it.
However, it was a requirement of the Roman system that each man who wanted to go into politics had to serve (in theory) 10 campaigns in the army before he could start his career. Even if they had not served quite that many, the men who commanded the legions would know their way around an army camp, and would have seen from up close how the previous generation of generals commanded their armies. Moreover, the Roman aristocracy was very martially oriented, and knowledge of military affairs was part and parcel of any aristocratic man's expected skillset.
On average, Roman commanders seem to have been no more competent or incompetent than their Hellenistic or Carthaginian counterparts.
A more significant idiosyncrasy of the republican Roman general is that he was an elected official, who usually only served as governor for a 12 month term. This obviously gave Roman generals an incentive to be extremely aggressive: if he didn't win a victory straight away, a political opponent might replace him and gain all the glory! This explains the various displays of risk-taking we see in our sources.
The Roman senate did sometimes prorogue governors/generals who were engaged in important wars, which could mean that successful generals got the chance to finish a job they'd started. But as Goldsworthy puts it: "whether or not a man's command was extended sometimes had more to do with his political influence than his ability." A famous example of all this is Titus Flamininus, the victor of Cynoscephalae, who only pursued war with Philip III of Macedon after his friends in Rome ensured the consuls of that year would not replace him as general in Greece.
Centurions in the Imperial Army
Now, in the 1st century BC the Roman army gradually shifted into a full-time professional force, and Augustus institutionalised many of these changes into what we've come to known as the Imperial Roman Army: a fully professional standing army, led by career officers.
However, career officers or no, there's little evidence that these were the grizzled NCOs of popular imagination either.
Some men were promoted from the ranks, to be sure. They would have served 15 to 20 years as an ordinary ranker, and would by any interpretation of the word be considered veterans. Many others were promoted from the Praetorian Guard. This makes political sense: that way, they would be men the emperor knew personally, and would be personally loyal to him. However, since praetorians only served 16 years and saw relatively little combat, these wouldn't be as experienced as promoted rankers.
But as often as not, centurions were appointed directly based on political connections. Indeed, the vast majority of the evidence we have (Inscriptions, documents, tombstones) does not mention any prior service as a ranker.
In short, we can't be sure how many of the centurions of the imperial army were experienced veterans, how many were politically convenient praetorians, and how many were rich or well-connected equestrians looking for a good assignment. All we can be sure of is that all three types of promotion happened.
Legates and generals in the Imperial Army
During the first few centuries of the Empire, the officers in command of most legions and most provinces would still have been Roman senators.
However, they were no longer elected but appointed by the emperor, and the men who ended up governing provinces with multi-legion garrisons would first have gained experience as a tribune, then as the legate of a legion, and then quite often as governor of a minor province first. So, in most ways, these men would have had considerable more experience with command than the magistrates of the Republic.
Did that make them a professional officer corps, though? Again, we can't be certain, but have to place some question marks.
Without the recklessness with which young men often make the profession of arms a mere pastime, and without indolence, [Agricola] never availed himself of his tribune's rank or his inexperience to procure enjoyment or to escape from duty. — Tacitus, Agricola, chapter 5
Tacitus here is contrasting his father-in-law's virtue with the typical indolence displayed by most officers. Of course, we can't really take Tacitus at face value here. It's quite possible he's exaggerating to make Agricola look good, and/or indulging in his typical moralising again.
What IS certain is that people were less promoted based on "objective" evaluations of merit, and instead almost always because they had influential patrons higher up the social ladder. In fact, letters of recommendation are the most common document to have survived the millennia. (The Romans were quite open about such things and did not attach any stigma to it at all.) This doesn't necessarily result in the promotion of incompetents, of course. For one thing, the patrons wouldn't want to recommend people who later end up embarrassing them. Still, many attempts to read the Roman army as a strict meritocracy reek of anachronism and projection.
Sources