When asked "What is flirting?", most people can give plenty of examples... what is considered flirting is much easier to answer, than giving a definition!
Many see flirting as a sexual gesture, often with the notion that "sex is bad" and something "a decent girl doesn't do" (strangely enough this somehow doesn't apply to boys).
I will not deny that many use flirting to get sex, but that's not the only reason...
There really is no need to think of flirting as a bad thing.
Flirting is a way to show that you are interested in the other person, either sexually or romantically.
The interest may be as superficial as just having some fun by leading someone on, or getting a one-night stand, and as involved as getting a romantic relationship. Unfortunately, it's often not easy to tell the one from the other!
The word "Flirt" is most likely to come from the French word "fleureter", or the old French saying "conter fleurette" which means to court someone or galantly talk (to a lady).