African Portuguese accents vary a good deal, as do Brazilian and to a lesser extent European Portuguese accents, but African and European accents are indeed much closer to each other than either of them is to Brazilian Portuguese. See this question about accents in Portuguese-speaking Africa, Portugal and Brazil. I cannot account for all the differences and similarities, but one good reason is that European and Brazilian Portuguese have been evolving autonomously for two or three centuries whereas African Portuguese is basically a recent offshoot of 20th century European Portuguese.
Portuguese settlement in Brazil started in earnest in the mid-1500s. According to estimates colonial Brazil had 100,000 people by 1600, 300,000 by 1700, and around 3.5 million by 1800, so surpassing Portugal towards the end of this period. At an early stage, while the colonial population was still small, the influx of new people from Portugal may have kept accents evolving in tandem in Portugal and Brazil. But at some point the Portuguese-speaking community in Brazil became large enough, so that newcomers would have little or no influence. Note that children pick up the accent from other children, not their own parents. So children coming from Portugal, or born in Brazil to Portuguese parents would pick up the Brazilian accent.
So accents in Portugal and Brazil began diverging. For instance beginning in the 1700s people in Portugal embarked on a wholesale reduction of pre-tonic vowels that Brazilians never took up (see Sérgio Carvalho, As Pretônicas < e > e < o > no Português do Brasil e no Português Europeu, 2010). So in Portugal corcovado is now pronounced /kuɾkuˈvadu/ (/kɔɾkɔ’vadu/ or (/kɔʁkɔ’vadu/ in Brazil); parada is pronounced /pɐˈɾadɐ/ (/paˈɾadɐ/ in Brazil; so the first a is closed as the last one in Portugal, but open as the second one in Brazil). As for pre-tonic e, in Portugal it is now often nearly or completely elided, so that Teresa will be pronounced /tɨˈɾezɐ/ or simply /’tɾezɐ/ (but /teˈɾezɐ/ in Brazil). This in turn enabled, I think, the stress-timed rhythm of European Portuguese, whereas Brazil kept a more syllable-timed rhythm typical of the other West Iberian languages.
This in my view accounts for most of the difference between Brazilian and European Portuguese accents (Sérgio Carvalho, more cautiously, says it is perhaps one of the most important differences; but let a Brazilian read out loud, without inserting any extra vowel sounds, Treza qria vzitar u curcuvado, and let me know what the listners think). The change process began in Portugal after the Portuguese language was well established in Brazil, but was fairly complete when people started migrating from Portugal to Angola and Mozambique in large numbers in the 20th century.
Portugal had kept coastal outposts in Africa from the 1500s, but, with the exception of Cape Verde, Portuguese presence there was very limited before the 20th century, and no significant Portuguese-speaking communities developed. See Wikipédia article on Angolan Portuguese and Perpétua Gonçalves História da Língua Portuguesa em Mozambique, 2000.
For instance the 18th century Afro-Portuguese elite in Angola spoke kimbundu as their mother language and Portuguese as second language only (Wikipédia). Portuguese presence in Mozambique was even less significant, so much so that until 1752 Mozambique was administered from Portuguese India (Perpétua Gonçalves).
Portugal effectively occupied the Angolan and Mozambican territories only in the late 1800s and early 1900s. And It was only after that that significant numbers of Portuguese people settled there, and took 20th century European Portuguese with them. It was from these people that significant numbers of native Angolans and Mozambicans first learned Portuguese. Still not everybody speaks Portuguese there today. In 2007 only 50% of Mozambicans spoke Portuguese, and only 11% as mother language (Wikipédia). In Angola 71% of the population speaks Portuguese (Wikipédia).