I understand that later in its development, it had borrowed vocabulary from other languages.
However, I have had conflicting explanations stating either it was purely Bantu and has existed before the arrival of the Arabian traders on the east coast of Africa or it was developed through the interactions of West and East Africans as early as the 1st century.
Swahili is a Bantu language. There are many loanwords in literary Swahili but in conversational Swahili they make up approximately 16% of the lexicon. The Swahili language is more than 1000 years old and existed before contact with Arabs. It is almost mutually intelligible with inland Sabaki languages to which Swahili belongs and a proficient Swahili speaker can more or less understand with minor difficulties other similar Sabaki languages despite the fact that Swahili has lost its tonal system.
The historical Swahili states were part of the Indian ocean and silk road trade routes. Arabs, being seafaring peoples came into contact with the Swahili and started trading with them. They brought their religion with them and since Arabic is the language the Quran is written in, knowledge of Arabic words grew until some common ones replaced many older Bantu versions. These are the Arabic loanwords.
People who were educated to the point of being able to read and write likely knew the Arabic language as well because they were educated Muslims and also because the Swahili language used to be written in Arabic script. These people wrote poetry and works of literature and since Arabic was seen as the language of educated persons, substituted many Bantu words for Arabic ones in their work. As well, there may have been words in Arabic for things that were not easily describe in Swahili so they chose to substitute them for Arabic. This is why it is said Swahili is part Arabic because many words in literary Swahili words are Arabic. However most people were not poets but simple laborers and for them Bantu words worked just fine and so only the most common of Arabic words that they may have heard of in the Madrasa from the Imam or heard from an Arabic sailor made their way into the practical everyday language.
Indian and Persian words also came into the language the same way. There is a sizeable Indian population in Mombasa from the days when ships loaded with spices sailed from its docks, to cross the ocean to the south-western Indian coast. Same with the Iranian/Persian population that used to be a significant group in Zanzibar.
These days English has become the new Arabic and many loanwords today are of English origin. That is the way of language; to give and take and evolve.
Follow up question: when did the Hindi words--e.g. kitabu, dunia--make their way into Swahili?