Anyone familiar with dating sims and romance visual novels will recognize the term "flag" in that context. In these games, when you are presented with choices which affect how the other characters view you and potentially change which route you go on, it's called a flag. "Raising a character's flags" essentially means that you make choices that improve your standing with that character and which are more likely to put you on his/her route.
This terminology is quite common even outside of visual novels in anime. For instance, the manga The World God Only Knows (a parody of the dating sim genre of games) uses the term frequently, and the manga chapters are numbered as flags (e.g "flag 53"). I've seen it in many other anime and manga as well, both in Japanese and translated into English. I was not able to find any reference for the term used in this way in either English or Japanese.
The term "flag" doesn't seem particularly romantic or descriptive in this context. There are other terms, like "affection points" (a slightly different system) which are easy to understand, but "flags" is at least as common as any of those. What is the reasoning behind the terminology "flag" in this context and where does it originate?