They were not comparable at all.
To go into a bit more detail.
During the First Punic War, the Carthaganians were using a a core of citizen's militia equipped and fighting like Greek hoplites - indeed, if you placed them in Greece during the war for hegemony, you would probably have a hard time picking them out among the armies of the Greek city states. The Carthaganians also had a special elite unit, the Sacred Band, which was made up of wealthy and influential members of the citizens or their sons.
However, the Carthaganians suffered considerable losses in the First Punic War and expanded their Empire to include a lot of land (in western North Africa and Iberia). Before they had mostly been focusing on trade. The inhabitants of the new lands did not become citizens, so the citizen militia they had been using was not enough anymore. It is possible there had been social change limiting the number of citizens or that the losses in the First Punic War also had eroded the social group that provided citizen soldiers.
Regardless why, by the time of the Second Punic War, the Carthaganians relied mainly on mercenaries to provide the manpower for their armies. Flush with silver from the Iberian mines, the Carthaganians could hire some of the best mercenaries of the Western Mediterrenean - Balearic slingers, Numidian skirmishing javelineers, Iberian and Gaul medium infantry, Numidian light cavalry and Iberian and Gaul Heavy cavalry. These were led by Carthaganian citizen officers and generals and formed into cohesive veteran armies experienced in the heavy fighting against the warlike tribes of Iberia. Generals like Hamilcar, Hasdrubal and Hannibal learned their trade there.
During the Third Punic War, when Carthage itself was destroyed in a siege, the Carthaganians no longer had vast silver mines from which to pay a mercenary army, they had to revert to using citizen soldiers again and even freed any prisoner who would fight for the city.
The Roman army of the Roman Kings and the early Republic had been, like the early Carthaganian citizen army, equipped and fighting like Greek hoplites. However, by the time of the Punic Wars, the pre-Marian Roman legion had taken over as an organisation.
The pre-Marian legion was made up of Roman landowners who had to field their own equippment. The poorest and youngest would fight like Velites, which were skirmishing javelineers. Those slightly richer would fight like Hastati light infantry and those with some experience and some means would fight like Principes mediu,m infantry while the older and richer veterans would fight like Triarii heavy infantry. Meanwhile, those rich enough to own a horse would fight like Equites light cavalry.
The Roman army also made extensive use of auxilia, either tributary forces from their allies (forced or willing such) or mercenaries, especially to fill out areas where their own army was not as strong (primarily slingers and archers and heavy cavalry). However, by the Second Punic War, the Romans were mostly cut off from any source of mercenaries - the Greek city states in Magna Graecia (southern Italy and Sicily) were hostile as were the Samnites, who revolted against Roman rule frequently. The Cisalpine Gauls in northern Italy rather served with Hannibal than with the Romans.
So, while the Roman system provided a strong infantry army and decent skirmishers, it lacked in missile troops and cavalry. It was a good army though, and more than enough to defeat the Carthaganian citizen soldiers in the First Punic War. However, during the Second Punic War, the lack of cavalry and missile troops compared to the well-rounded mercenary Carthaganian army under Hannibal proved disastrous in several battles, most prominent of them Cannae.
Rome won because they were able to not only deal with Magna Graecia and Sicily (including Syracusae, the largest Greek city state in Sicily) but also keep raising new armies to face Hannibal, while he was cut off from further support and started alienating his allies in Italy with the presence of his army (as it needed supplying).
The Romans kept raising new armies, Learning from their defeats and acquiring support from Carthage's subjects and allies from which they hired their best mercenaries.