It's a well known theory but it's most likely false[1], though there are several words imported to Japan via Portuguese that have long remained, such as the word for England, イギリス, which comes from the Portuguese for English (people), Ingles, which drives me a bit potty as it's used now to refer to the whole of the UK and I have trouble trying to distinguish England from Scotland et al when speaking with Japanese people.
Ironically, "Japan" is from an old Chinese word for Japan that was then imported to Europe… by those dastardly misnomerists of countries, the Portuguese!
It's actually related to the English phrase "much obliged!" -- from the Latin obligare, participle obligatus, meaning to indebt (both morally and fiscally).
You shouldn't usually try to guess etymology based on superficial phonetic similarity, especially for such a common word. It is exceedingly unlikely that a country would adopt a language would just adopt a word for giving thanks (though there are exceptions).
Just for some fun of even greater coincidences between Japan and a Romance language, there are two almost identical words in Japanese and Romanian that have no etymological relationship: "sat" / "里" ("sa to") meaning village in both languages; and "baba" / "婆" ("ba ba") a derogatory term for an old woman in both languages ("hag").