Jeremiah 39:3, 13 is the earliest of ancient records mentioning magi.
The word "Rabmag" is merely transliterated because the original translators did not understand its meaning, and even subsequent translations have left it untranslated. However, it has since been correctly deciphered as "chief magus."
The best translation authorities say that "magus" (a singular form of "magi") comes from an old Pahlavi Persian word mag or mog, meaning "priest" or "great one." Thus, a man by the name of Nergal-Sharezer was the "rabmag" or "chief magus" of the Babylonians at this time (about 586 BC) when they were conquering Jerusalem.
The magi of Babylon were heathen physicians, priests, and learned men, and it is said that from them descended a line of evil, perverted priests and sorcerers (said to include Haman of the book of Esther and Barjesus or Elymas of Acts 13). It is not at all likely therefore, that the magi of Matthew 2, seeking to worship the newborn King of the Jews, could be included with the likes of these men!
Who Were the Wise Men?