If the Portuguese incursions into the Swahili Coast had failed, where would the city-state have gone from there? Would they have united or started to push into the interior toward the Great Lakes?
They already were relatively united under the Kilwa Sultanate prior to the Portuguese incursions. If the Portuguese incursions had failed, then the Kilwa Sultanate would have probably adopted a more expansionist colonial approach, attempting to maintain its own supremacy as the region's dominant oceanic trading power, and looking to prevent both the Portuguese and any upstart Europeans wresting control of the Indian Ocean Spice Routes from its grasp for as long as it possibly can. They may well have pushed further inland, but still, as a thalassocractic confederation, their primary focus was always on controlling the high seas.
Of course, that's far easier said than done- but still, if they manage to forge alliances with a few European rivals of the Portuguese (the Dutch seem like the most plausible candidates), and get a decent transfer of technology going, then they could well have held the Europeans at bay. IMHO, the best case scenario for the Kilwa Sultanate (or its successor/s) in this event would be comparable to OTL's Japan; worst-case scenario would be comparable to OTL's Barbary Coast (ie, pretty rough and tumultuous, but still ending up better off as a whole than the region of East Africa did IOTL). Most plausible scenario, TTL's East Africa would have gone the same way as the region of South-East Asia did IOTL.