If you read any dated text in Japanese that refers to Islam, or, say, watch the movie Ghandi with Japanese subtitles, you may see the word Islam written with the characters 回教, or kaikyou (or in Chinese, huíjiào). Archaically this was also written 回回, in which case it was pronounced Uiui in Japanese and huíhuí in Chinese. Where did these characters come from and why were they used to refer to Islam?
Christian Europe’s first interraction with the Islam religion was with the Arab Middle East and with the first Caliphate that rapidly expanded to dominate the Middle East, North Africa, and Persia and directly challenge the waning influence of the kingdoms of post-Roman Europe. The Far East had a much slower and gradual introduction to the religion and the Muslim people. The first reference of the characters identified by scholars is during the Northern Song Dynasty in the 10th to 12th centuries, when the characters 回回 were used to refer to the religion of the Uyghers (the name of the people was written as 回鶻、or 回紇). For centuries, the words were used almost interchangeably because the Uyghurs were the only Muslim people known to the Chinese, but as Islam spread, the characters 回回 were expanded to broadly include more people than just the Uyghurs, and during the Ming Dynasty, the characters 回回 were converted into 回教.
Through the Ming and Qing dynasties, Chinese people who converted to Islam and who lived in China were called 回民, and the Turks of Central Asia were called 回部. Today, characters 回族 refer to the Hui people, a minority ethnic group in China of people who appear Chinese in external appearance but who follow the Muslim faith. The word 回部 refers not to the Turks of Central Asia but the Uyghurs. Exactly when the words came to Japan, or when they arrived in Japan and were understood, is not understood, at least not in any resource that I can find in my online research.
In the mid-20th century, the words were slowly understood as being inaccurate and possibly politically incorrect. Japan now almost universally uses the word イスラム教 or イスラーム, while the Chinese use the words 伊斯蘭教 (Yīsīlánjiào). However, Vietnam, which converted to a Roman letter alphabet in the 19th century, still keeps the old word for Islam with the word Hồi giáo, adopted from the original characters.