We go to rock and roll dance nights, lots of flirting, no fights, people generally go home with the partner they arrived with. It’s a form of flattery.
People like to seduce, rarely on a sexual level but often on a social or business level. Call it charm if you wish. People like being seduced too. You can seduce people of the same sex, the other sex, you want them to find you interesting, amusing, astute, worth knowing, sexy (even if you don’t want sex with them).
Take flirting as a compliment however it’s intended, if you’re not interested make it clear – IMO harassment only starts after you’ve made it clear you’re not interested.