Who would win? Case in point
In order to reach a definite conclusion as to who would win in a battle between a Greek Phalanx and the Roman legion, let’s look at some real-life historical examples. The Romans lost the Battle of Heraclea in 280 BC against a kinsman of Alexander the Great – the very man who came up with the idea of a Phalanx in the first place. However, there is strong evidence that suggest that the only reason the Romans had lost this battle is because the elephants got involved in it and Roman legions had no experience fighting them. The Roman legions had gone on to win the Battle of Pydna in 168 BC due to their superior ability to maneuver on a rough terrain, and the Battle of Zama in 202 BC which marked the end of the Second Punic War. The latter was arguably won by the Romans due to their superior professionalism and experience, as well as ability to use their troops more efficiently than a single dense mass of people. The Mithridatic Wars were also won by the Romans, with Mithradates eventually choosing to restructure his military forces Roman style.
To conclude, while both the Greek Phalanx and the Roman legions were powerful in their own ways, the Roman legions would be most likely to win the battle between them.