It's derived from the word "bandhana," which means "to tie" or "to bind." This makes sense given that bandanas are typically tied around the head or neck.
The word was adopted into English from the language of the Indian subcontinent, likely during the British colonial period.