How did Africa become Africa?

The name 'Africa' has its history in the distant past, 'Afri' was the name of several Semitic peoples who dwelt in North Africa near Carthage. Their name is usually connected with Phoenician "afar" meaning 'dust.
The name may also perhaps be associated with the Berber word "ifri" meaning 'cave', in reference to cave dwellers.; Africa or Ifri or Afer is name of Banu Ifran tribes people from Algeria and Tripolitania or Berber tribe of Yafran.

The point is that in ancient times the people of North Africa were referred to by the Mediterranean peoples as the 'Africans', and it is from this derivation that the continent on which they lived was called Africa.