Code-mixed slang from gaming and ACG (anime/comics/games) culture. The English 'flag' is the programmer's term — a boolean variable that triggers a future event. In visual novels and games, an early line like 'I'll definitely come back alive' is a
死亡flag ('death flag') — guaranteeing the character dies. Internet Chinese generalized
立flag to mean 'to make a confident declaration that fate will now mock,' close to English 'jinxing it' or 'tempting fate.'