To the ancient Greeks the sound made by two foreigners talking together was as if they said “bar-bar-bar-bar” to each other.
So they called any unintelligible speech, barbaros, and applied it to any language that was not Greek.
Later on, the Romans borrowed the word, changing it to barbarus, and had it apply to any language that was neither Roman nor Greek. The sense then became extended to embrace anything of any nature that was foreign to either Greece or Rome.
That included the people. So great was the feeling of superiority among Greeks and Romans that they considered customs which differed from their own and all foreign persons to be necessarily crude, uncultured, and uncivilized.
Although barbarous, which we in turn have borrowed, still retains this latter meaning, we no longer apply it indiscriminately to all foreign ways and persons.