Gang,
Phalanx vs. Legion has been debated ad nauseum. Wargames have been developed to fight it out! We generally know the answer ..... (you should too!)
The Romans used a 'phalanx' (spear formation closely packed) until the Samnite Wars. Unfortunately, the hilly region around Rome, especially in Samnite country, made the use of a phalanx pretty impossible. Rome suffered one of its worst defeats ever at Caudine Forks (321 BC). Afterwards, they adopted a different panoply, better developed for loose formation. They used a series of maniples.
Later Romans wore heavy armor, had shields, and short, thrusting swords. Phalanxes used long spears, very long in Alexander's time. They also had heavy armor.
The power of a phalanx came from its momentum. During the 5th century, when there were non-professional Greek troops (with the obvious exception of the Spartans), the most experienced soldiers were placed in the rear, with the youngest and most fit up front. The rear ranks would 'push' forward, and try to break the enemy formation through power.
It's important to remember that with heavy infantry, with spears, formation was everything. Once the enemy formation broke, the winning side would defeat the enemy in detail, taking few casualties. We hear in the ancient world how terrifying it was to see the Spartans, with their bronze armor, long hair, glistening in the sun.
The legions, in maniples and later three lines, were flexible, looser formations.
So, what happens if a legion goes head on against a phalanx? The phalanx wins, there is no question. The direct power of a phalanx is far greater. But, the Romans wouldn't let that happen!
The three classic battles between Greek and Roman war machines were in the second century BC. Unfortunately for military historians, this was after the Greek prime, and before the Romans, clearly pre-Marian. But, despite the Phalanx power, the Romans won all three.
The battle of Magnesia was largely a confused affair (190 BC), and Rome's ally had a lot to do with it. So let's talk about the other two.
The most telling battle was Cynocephalae (197 BC). The Greek phalanx advanced, with its great power. The Romans were beaten back. However, the phalanx wasn't that well formed (it took a long time to 'set-up' a phalanx properly). A Roman formation, however, was easy to form.
Somewhere in the battle, some now unknown Roman officer managed to put together a line (showing the flexibility of Roman command), managed to get them under control, marched to the Macedonian right, flanked the Macedonians, and the inflexible phalanx couldn't turn. It was a complete Roman victory, and lead essentially to the beginning of Roman conquest of the east, with modern Turkey (Asia Minor/Anatolia) falling to Rome.
The other key battle was Pydna (168 BC). Here, the Romans tried to handle the phalanx power by chopping off the end of the spears, and trying to get in between gaps. It didn't work, and the Romans were being driven back. This time, however, the Greek advance moved onto hilly terrain. As they moved forward, gaps appeared, and again, the quick-thinking Romans moved into the gaps in the line. A phalangist out of formation, not supported by the guy next to him, was no match for the nimble Roman, and the Romans again won decisively.
So, straight on, most military historians view the Roman system as superior across the board as a 'universal' formation. And the Marian legion was far superior to its 2nd century BC counterpart.
So, what would have happened if Alexander met a super Roman general? Alas, we don't know. Why? Because Alexander almost certainly would have known that attacking with his phalanxes caused them to be vulnerable. He was too smart. Alexander broke through with his heavy cavalry (pretty much always.) The phalanx would 'pin' the enemy, not allowing them to break. And a phalanx in formation, stationary, was quite a formation. Alexander used combined arms, phalanxes, heavy cavalry, and hypaspists, which is why he was so brilliant and successful. So, Alexander would not have allowed the Roman legions to pick on his phalanxes alone.
The battle between a complete post Marian Roman army and a top notch Macedonian army is debated endlessly, and is the stuff of the wargame industry!
But there is a reason those Praetorians are 8's ......
Best wishes,
Breunor