The reason is that this was the Second Punic War. During the First Punic War the Carthaginians beat the Romans more than once, destroying their fleets...and the Romans built another fleet. This was what the Romans did. They did not give up just because they lost an army or a navy. They just raised another. And the First Punic War was not exceptional. A century earlier, when Pyrrhus of Epirus invaded Italy the Romans fought him and lost, and fought him and lost again. And fought him and lost again until Pyrrhus had to withdraw, having lost too many men to continue while the Romans just raised another army.
Hannibal knew that attacking a Roman field army -- a chancy thing, anyway -- would do little to win a war against Rome. They'd fight, Rome might win or it might lose. If Rome won, Hannibal was done, because Carthage was a sensible merchant city who would cuts its losses. But if Hannibal won, Rome would raise another army and fight him again. And again. And Hannibal couldn't afford a Pyrrhic victory, either -- too many losses and Carthage pulls the plug.
Under these circumstance, a battle against Scipio in Spain was at best a distraction and at worst a no-win situation.
Instead of planning to meet and defeat one Roman army after another, Hannibal decided on a strategic plan of invading Italy and separating Rome from its Italian allies whose manpower was a major source of those endless armies. (Many of those allies were recently conquered -- why would they be loyal?) Hannibal judged that if he could put a powerful army in Italy, and especially if he could win a battle or two, Rome's allies would revolt, and Rome would be forced to come to terms. (And, note, he never needed to attack Rome itself -- the plan was to isolate it, not to storm its walls.)
Of course, it turned out he was wrong. Even though he won huge victories at Lake Trasimene and at Cannae, all he achieved was a stalemate and the revolt of a fraction of Rome's allies. He was cut off, Rome raised new armies and found a great general in Scipio. Scipio invaded Africa, Hannibal had to follow, lost the battle of Zama -- and Carthage cut its losses and surrendered.
If Rome had been Carthage, Hannibal would have won.