With the Greeks using their notorious phalanx formation. How were the Romans able to counter that tactic and and defeat the Greek armies.
Rome didn't really have to defeat them originally, the Romans defeated the Macedonians under Philip V who ruled Greece. With his defeat at Cynoscephalae in 197 BCE, the Roman commander declared that Greece was free - but unstated was that they were to acknowledge Roman hegemony. Only in 146 did the Achaean League rebel against Roman authority - and this was after Rome had repeatedly trounced the Macedonian phalanx in successive wars. The league was swiftly defeated and Corinth ruthlessly sacked as an object lesson. The league had no chance, the Romans could count on a massive population base, one that had a significant proportion of veterans with a proven military system.
The phalanx had many disadvantages in contrast to the manipular legion, it was more unwieldy and required flat terrain to properly use. The legion was very resilient - it held up at Cynosceophalae despite being pushed back downhill by Philip's right wing, it was flexible - a tribune was able to take 20 maniples from the victorious Roman right and attack Philip's right wing from behind.
The phalanx stands like a continuous, immoveable wall when used correctly. The roman maniples were like small segments of maneuverable phalanx. The Romans could probe the plalanx for weakness, punching it in places with the manipular "fists". Once they punched through, more maniples could maneuver through the line, rapidly flanking the phalanx, which could not maneuver in response.