Phonetic loan from English 'bye-bye,' written with 掰 (bāi, normally meaning 'to break apart by hand') purely for sound. Casual and cute — common in texts, voice messages and especially Taiwan usage. For formal contexts use 再见 (zàijiàn).
mistakes
Don't write it 拜拜 (bàibài) for the goodbye sense — that's also used but originally means 'to worship.' Both spellings exist; 掰掰 is the more colloquial, internet-friendly one and tracks the English vowel better.