I not again to sources that don`t cite : Mana musa and Islam in africa: Crash course world history 7:40 Wikipida History of africa swahilli coast
It's both. Swahili societies (each was a little different) were fusions of existing agripastoral populations usually on the coast already, and a trading town founded by merchants on a peninsula or island with good provision for ships. Occasionally they'd be on a coast proper but it was important to have the best anchorage. These towns required the blessing of local rulers, and often intermarried ; the locals over time became Islamic. The language reflects the population balance: it's a Bantu language with a lot of borrowing from Arabic and a bit of Hindi vocabulary, but the basic words tend to be of Mashariki origin. The merchant families would however continue to move around and even relocate, as when the Omanis took over Zanzibar circa 1750, and they'd know Arabic as well. But it was an evolving fusion in its origin. Tom Spear co-workers, long ago, a very good linguistic and historical analysis of Swahili emergence, and Maxon's general introductory history of East Africa (2009 ed) should get into it too.