It's from old tupi. So all those languages simply borrow it for this"new"type of crop. For Swahili, the i sound in the end is common for borrowed words.
In Mexico, the widely preferred word is piña. I would assume that most people wouldn't understand the word ananás, but, as it is a literary word, some people know it.
Pineapple
Origin: late Middle English (denoting a pine cone): from pine + apple. The word was applied to the fruit in the mid 17th century, because of its resemblance to a pine cone.