It comes from the Greek word βάρβαρος (barbaros), which originally referred to foreigners or people who spoke a language that was unintelligible to the Greeks.
The term was initially neutral, but it later acquired negative connotations, often used to denote people considered uncivilized or savage.