Carthage was much more powerful than Rome was, and Rome really had no business thinking it could have won either of those wars. Rome lost so many battles during those wars, and only survived by outright refusing to give up, and then somehow pulling it out of the bag at a key moment. This battle was one of those moments, and Zama was another in the second war (in a campaign that Scipio basically had to fund himself after failing to get the support of the senate).
There were so many moments in both of those wars where if it had gone another way, Rome could have very easily failed and become a Carthaginian vassal state. There would have been no Roman Empire, which arguably still shapes Europe to this day, and the history of Europe would have been a continent dominated by a North African empire.