History lesson, because I find the story interesting.
The Carthaginian Empire (in the North of the continent now called Africa) is weak after warring with the Romans. Carthage had been made to sign a peace treaty, forbidding them from attacking Rome or Rome's friends. Rome becomes convinced that as long as Carthage exists it will be a threat to the Empire.
Masinissa, the King of Numidia (now part of Algeria) wants the walled city of Carthage for his people; he is a friend of Rome, and goes around conquering Carthaginian land, confident that Rome will not interfere against him, and that Carthage will not want to break the treaty with Rome. Carthage does decide to fight back; conveniently for Masinissa, a Roman consul is with his army when this occurs. The consul sends word to the senate, who declare war on Carthage.
Carthage panics; they couldn't beat Rome at war. When the Romans arrive, they send ambassadors calling for peace, saying that they've already killed those responsible for declaring war, and provide the Roman soldiers with provisions, hoping for goodwill. I imagine the conversations going something like this:
Carthage Ambassador: We want peace! What do we have to do?
Roman Consul: Yeah, ummm, first can we, like, have 300 children? Not just any children either, children of senators. Politician's children, yeah. That OK?
Carthage delivers them to the Roman camp, and the children are sent away on galleys.
Carthage Ambassador: Anyfin else?
Roman Consul: Err, yeah. We want your entire city disarmed. All weapons brought here.
The ambassadors return to the city, have the populace gather up all weapons and deliver them to the Roman camp.
Roman Consul: Sick.
C. Ambassador: Is we at peace now, yeah?
R. Consul: Nah m8, there's one more thing.
(Here I imagine there is the noise of other Romans trying to suppress giggles and thinking 'Is he actually going to ask them?' 'Will they actually do it?')
C. Ambassador: What is it?
R. Consul: Yeah, hehe, you gotta burn ur entire city to the ground. Chillout! You can build a new one! Just move inland so you aren't a powerful trading post and make sure ur new city ain't got any fortifications or city walls or anyfin defensive like dat.
The Ambassadors return to Carthage, and inform the people of Rome's command. The people decide to defend Carthage to the last man. All slaves were freed to fight. Weapons were made however possible: buildings were torn down for metal and wood; hair was woven into ropes for catapults. A message was sent to the Roman camp, asking for more time to make the decision. After a few days, the Romans got impatient and went up to the city gates, enquiring why the city hadn't been burnt down yet.
[Masinissa was really pissed off with Rome at this stage; he had wanted Carthage for himself. He went home sulking.]
The siege lasted more than three years. Eventually, Rome managed to prevent traders from entering Carthage. The inhabitants began dying of starvation and disease and went mad trying to deal with all the corpses, and fighting over the remaining food. Word spread that Carthage was going to fall, and the Romans were joined by people who wanted a bit of the looting-Carthage action. The army entered via Carthage's harbor, ransacked the city in a week. The city was set on fire, and it took 17 days to burn down. The site of the city was ploughed, turning it into cattle grazing ground.
The land that had belonged to Carthage became the Roman province of Africa, named so because the Latin name for Carthaginian people was 'Afri'.
As more land was conquered by the Romans and the Greeks (who inherited the province after the fall of Rome), the name spread; more land came to be called 'Africa'. The name was spread even further by later European explorers. Eventually, the whole continent came to be called Africa, after the people of that city that was burned down that time.