First you have to understand that Hannibal's aim by invading Italy was to inflict such defeats on the Roman armies that their Italian allies would rise up in revolt and break their alliance with Rome. If this happened Republic would be stripped of manpower and the senate forced to negotiate.
After completely destroying the Roman army at the famous battle of Cannae , many of the southern Italian city states included Capua revoked their allegiance to Rome and became Hannibal's allies; additionally the way to Rome was now clear. However, the Carthaginian army had suffered casualties and could not make a direct assault on Rome, this was the beginning of the end for Hannibal, as the Romans were able to recover and rebuild. They began to wear Hannibal down and refused to give battle ( the Fabian strategy). They also began to reconquer Hannibal's Italian allies. Eventually Hannibal had to retreat to an allied city know as Croton to rest and try to get reinforcements. It was at this time he was recalled back for the decisive battle of Zama which Hannibal lost, this led to Carthage's defeat.
Really the main reason Hannibal lost despite winning so many battles was the Romans ability to isolate Hannibal in Italy, while they prevented reinforcements and took out other parts of Carthage's empire. The Roman senate also refused to negotiate with Hannibal, which was a necessary part of Hannibal's plan.
Sources:
Rome and Her enemies: Jane Penrose The War with Hannibal: Livy The Complete Roman Army: Adrian Goldsworthy
The answers here are fantastic, so I don't really feel the need to add anything.
HOWEVER, if you want an entertaining and very informative mini-series on it - Extracredits did a fantastic job: