Partly as a result of poor commanders and partly because the Romans had an innate and misguided belief in the invincibility of their legions, the first battles against the Cimbri were a series of disasters. These culminated in the Battle of Arausio in 105 BC when two Roman armies were utterly destroyed.
Rome finally realized that their republic faced an existential threat, and made the necessary painful political and military changes that were needed to face that threat. Rome also found a commander who could take on the Cimbri. Caius Marius was a deeply flawed man - scheming, cautious to the point of cowardice, and quick to claim credit for the achievements of others. Nevertheless, he was a massive improvement on the leaders who had preceded him.
The reshaped Roman army eventually worked out how to weather the savage onrush of the initial barbarian assault. Thereafter, the grim discipline of the legions was enough to wear down the opposition. It helped that Marius never fought unless the situation favoured him, and as a result his army gradually became accustomed to victory.
Had the Cimbri overwhelmed Rome, as at one time it seemed inevitable that they would, then European history would have been very different.