It was Battle of Callicinus during the Third Macedonian War in 171 BC.
What caused the Roman legions to prevail over the Greek Phalanx were the legions' mobility and flexiblity. Once a phalanx stated moving, it couldn't turn to deal with any rear threats. Also, the phalanx need large even ground to work. Any rise and depression in the land would create gaps and destroyed the cohension that the phalanx on which it was based. A example of this was the Battle of Pydna in 168 BC where the legions took adavantages of these two deficits and put their loger swords and heavier sheild to work in the created gaps, something a phalanx could not exploit were it given a similar opportunity.