That is what I’ve read, too, but it said that the name was derived from the indigenous Tupi language, which used to be widely spoken in Brasil.
In Tupi, “oba” means “leaf” and “ma” means “animal”, referring to the very particular body shape of the animals in this biological genus.
N. B. Words like “cashew”, “jaguar”, “tapir”, “maracuja” “kinkaju” or “manioc” have been adopted as loanwords in English and some oher European languages, and so has the German term for pineapple (”Ananas”).
/smartypants mode off
Sorry, I actually wanted to write: “...and the German term for “pineapple” has been loaned from Tupi as well.”
Reminds me:
What’s Beethoven’s favorite French food?
Un ananas
(You don’t pronounce the “s,” so it sounds like the 5th symphony’s theme.)