Hannibal died by suicide with poison. After his defeat and subsequent political struggles in Carthage, he fled into voluntary exile and eventually ended his own life to avoid being captured by the Romans.
Hannibal Unleashed: A Quiz on the Legendary Carthaginian General