You don't really need anything more than random chance and the statistical anomaly that flows from specifying that the island nations be "small" to explain the pattern observed, even though proximity to the ocean and current and historical ties to areas outside of Africa are actually probably also factors.
Taken together, this suggests that there is no really special connection between the physical geography consideration of a country being a small island nation and its HDI. This is despite the fact that focusing on "small" island countries, treating each country as a single data point statistically, and making decisions to include countries within the data set that it is fairly arbitrary to classify as "African" appears to create a much stronger statistically significant relationship to this factor than a wider view of the facts with a richer context for the data points would support.
Coarse v. Fine Grained Statistics
Simply put, if you broke up Africa into units of comparable size to those of the "small" islands, some of those units would have a relatively high HDI against an overall fairly low background. Economic development tends to get in virtuous cycles in city sized areas.
You can see this on this map, which shows wide variation in HDI within different regions in many continental African countries (although even these subunits almost all have greater populations and areas than small African islands leaving them still more coarse grained):
It is also worth noting that the map does not have fine grained subnational details for Algeria, Libya and Egypt, which is misleading. Algeria and Libya actually have significant disparities between the coast (where the vast majority people live and the major cities area located) and the deep Saharan interior (where the less Arabized Berber population and other ethnic populations that have historically been Saharan nomadic herders predominate).
Likewise, economic development in Egypt is highly disparate between the Nile basin and the remainder of the country. Egypt's Saharan and near Saharan west outside the Nile basin is actually quite challenged compared to the Nile basin.
If the North African statistics were more fine grained, more of North Africa would have a "medium" rather than "high" HDI index.
But, if you immerse the pockets of high HDI in continental Africa in whole larger countries, this gets diluted statistically. And, most mainland African countries are larger than most island nations in Africa, with Madagascar being the exception.
Nigeria, for example (which has 225 million people speaking 525 languages, and a land area greater than California and Texas combined) has an exceptionally wide spread between its interior North with an extremely low HDI and its coastal South which has areas on the high end of the medium HDI range (and would have a few pockets of high HDI within its major cities if one were to be even more fine grained than this map in its statistical analysis).
Similarly, for example, Namibia's has one pocket of high, rather than medium or low economic development in Erongo, which has one of the highest HDI indexes in sub-Saharan Africa outside of country of South Africa. But, at the coarse grained national level, this is invisible and diluted by areas of medium and low HDI indexes in Namibia.
In the same way, is you were to single out Chicago from Illinois, or Philadelphia from Pennsylvania, both of those areas would be much more economically prosperous than the states as a whole and would rank higher in a per capita GDP measure than the states themselves do because the high points are diluted.
The same phenomena in the United States is one of the reasons that, for example, the District of Columbia, which consists only of the central city of a larger metropolitan area, is often at an extreme ranking on many social science statistics in the United States (e.g., having the oldest average ages of marriage).
Proximity To The Ocean Helps. Why Is This So?
Proximity to the ocean (which, of course, coastal areas in continental Africa have to the same extent as island nations) is indeed a factor as well, for reasons that have a complex history rooted in maritime trade with European colonial powers.
Through the 1500s, Africa didn't lag far behind the rest of the world economically, educationally, technologically, or militarily, and interior regions of West and Central Africa were more prosperous than coastal regions (exemplified by places such as Timbuktu) because of the role of these regions in facilitating trans-Saharan trade.
But, this changed when maritime trade conducted by European colonial powers largely superseded trans-Saharan trade. Abel Gaiya, writing from Nigeria in a February 9, 2023 article in the Republic, recounts at length the complicated historical sequence of events that led African economic prosperity to flip from interior to coastal regions in West and Central Africa.
This suggests, contrary to the analysis in the answer by Tyler mc, that the key economic benefit to ocean access is access to maritime trade and investment, rather than access to particular natural resources like seaweed. Lots of continental African countries have immense high value natural mineral resources, access to the ocean, and tropical weather as pleasant for tourism as island destinations in the Caribbean, Polynesia, and the Indian Ocean. Yet most of these countries remain poor and have low HDI rankings.
This said, it would also be wrong to omit the one exception that proves this rule, which is Namibia. The population of Namibia, and it urban and economic development, is overwhelming inland of its coastal mountain range, rather than on its coast. Namibia's one pocket of high, rather than medium or low economic development is similarly in the center of the country, rather than on its coast.
Obviously, of course, it is also true in the larger global context, that while 40% of the world's people live within 60 miles of a coast, there are economically prosperous areas with higher HDI that are far from any coast. Denver, Colorado, the Czech Republic, the Australian Capital Territory, and the federal district of Brazil, for example, come immediately to mind.
Are These Really "African" Island Nations?
As a final point, classifying the Indian Ocean island countries of Mauritius and Seychelles, and the Atlantic Ocean country Cabo Verde and São Tomé and Príncipe as "African nations" is rather arbitrary.
Since the lynch pin of the "small island nation" hypotheses in the question depends heavily on these four countries, their marginal relationship to continental Africa casts doubt upon this hypothesis.
The classification of Comoros as a small African island nation is not arbitrary, but needs to be considered in light of the near total replacement of its population between 1790 and 1820, which is a comparatively recent anomaly that is unprecedented anywhere else in this set of 55 countries. Comoros also just barely crossed the line from having a low HDI to a medium one in the last fifteen years, after a 48 year history of independence that has included at least fifteen coups and other deep barriers to economic development.
Two-thirds of the 1.3 million people of Mauritius are ethnically Indian and the plurality religion of the country is Hindu. Only 28% of the people of Mauritius are "Creole", which is a mix of former slaves with East African Bantu roots, and former slaves with Malagasy roots who are a mix of East African and Southeast Asian ancestors - in both cases with a smattering of European and South Asian ancestry as well. If one had to associate Mauritius with one continental area based upon its economic and cultural ties, India would be a better fit than Africa.
The hundred thousand people of Seychelles (about the same population of a single block in Manhattan and a third of the population of Iceland) has deep influences from Southeast Asia, Europe, and Arabia historically, as well as Africa via the Southeast Asian-East African hybrid people of Madagascar. Culturally and ethnically, the Seychelles are neither here nor there.
The Seychelles were uninhabited prior to about 1000 CE when Southeast Asian sea farers arrived, and people of African origins did begin to arrive there until later in the 1600s.
Seychelles was uninhabited throughout most of recorded history. Tombs
on the island, visible until 1910, are the basis for the scholarly
belief that Austronesian seafarers and later Maldivian and Arab
traders were the first to visit the archipelago. Vasco da Gama and his
4th Portuguese India Armada discovered the Seychelles on 15 March
1503; the first sighting was made by Thomé Lopes aboard Rui Mendes de
Brito. Da Gama's ships passed close to an elevated island, probably
Silhouette Island, and the following day Desroches Island. They mapped
a group of seven islands and named them The Seven Sisters. The
earliest recorded landing was in January 1609, by the crew of the
Ascension under Captain Alexander Sharpeigh during the fourth voyage
of the British East India Company.
Classifying the Atlantic Ocean island nation of Cabo Verde (which has a population of 562,000 people) as "African" is likewise arbitrary. As explained at the link:
Before the arrival of Europeans, the Cape Verde Islands were
uninhabited. They were discovered by Genoese and Portuguese navigators
around 1456. . . In 1462, Portuguese
settlers arrived at Santiago and founded a settlement they called
Ribeira Grande. . . .The original Ribeira Grande was the first
permanent European settlement in the tropics.
Cabo Verde has many people who are freed slaves of African origin, as a consequence of the island chain serving as a hub of the 16th to 18th century slave trade when it was a Portuguese colony. But in terms of human geography, it is no more African than say Jamaica, which has a large population of African origin for the same reason.
Cabo Verde did maintain stronger African ties, with its movement for independence from Portugal from 1956-1975 organized by the African Party for the Independence of Guinea and Cape Verde (PAIGC) which united an African Portuguese colony with Cabo Verde. But its history and people really have more in common with the Iberian colonies in the Americas and the Caribbean than it does with the peoples of continental Africa.
São Tomé and Príncipe
The 223,000 people of São Tomé and Príncipe in the Atlantic Ocean live in a country with a history strongly parallel to that of Cabo Verde, as a previously uninhabited island, discovered by Portuguese explorers in the 1400s and run as a colony economically reliant upon the African slave trade for centuries before its mostly African origin population rose up with a mainland African alliance and eventually secured independence in 1975.
For the same reason that it is somewhat arbitrary to classify Cabo Verde as an African island country, it is somewhat arbitrary to treat São Tomé and Príncipe as an African island country.
Comoros is a small island country with 851,000 people with a medium HDI between Madagascar and the continent of Africa which shares a largely common history with Madagascar up through its first encounter with Portuguese explorers in 1503, and was a trading post for Indian Ocean Arabian seafarers after early contact with Austronesian sea farers from Southeast Asia ceased.
The historical population of Comoros, however, was almost complete replaced in the time period from 1790 to 1820 in a little know historical African genocide:
In the last decade of the 18th century, Malagasy warriors, mostly
Betsimisaraka and Sakalava, started raiding the Comoros for slaves and
the islands were devastated as crops were destroyed and the people
were slaughtered, taken into captivity or fled to the African
mainland: it is said that by the time the raids finally ended in the
second decade of the 19th century only one man remained on Mwali. The
islands were repopulated by slaves from the mainland, who were traded
to the French in Mayotte and the Mascarenes. On the Comoros, it was
estimated in 1865 that as much as 40% of the population consisted of
France first established colonial rule in the Comoros by taking
possession of Mayotte in 1841 when the Sakalava usurper sultan
Andriantsoly [fr] (also known as Tsy Levalo) signed the Treaty of
April 1841, which ceded the island to the French authorities.
Unlike the other four cases discussed in this section, it is not arbitrary to call both the original and the replacement populations on these islands a very short distance from the Indian Ocean coast of Africa a small African island nation.
But, like the other four, it does have a highly disrupted history which is really for all practical human geography purposes, shorter than any of the others.
It is also worth noting (from the same source) that:
[Comoros] has experienced more than 20 coups or attempted coups, with
various heads of state assassinated. Along with this constant
political instability, it has one of the worst levels of income
inequality of any nation, and ranks in the worst quartile on the Human
Development Index. As of 2008, about half the population lived below
the international poverty line of US$1.25 a day.
Comoros is just barely over the line between low HDI (0.550 and less) and medium at an HDI of 0.558 in the link cited in the question and is at close to the bottom of the medium ranked entries on that list. But this improvement from low to medium appears to be because it turned itself around slightly only in the last fifteen years, rather than due to any benefit foreordained or strongly biased by its status as a small island country.