“FLAG” meaning in ‘bullet hell-style subtitles’ (弹幕)?
It was initially adopted by computer programmers. In order to mark the state of a certain block of code, they commonly use a variable called "FLAG" to store the value of state. For example you could have FLAG = 1 to mean that the user is male, then the following code blocks will work on the premise that the user is a male. Likewise, you can have FLAG = 0 to mean the user is female, then there will be a different logic followed. 

Then it's widely used in China(first in Japan) to indicate some character's line indicates that something will happen in the future, usually someone's death. 

For example, when someone says "Don't worry, I'll be right back. I promise." Then usually he/she is going to die.

Another example, when a girl says "I'll never date someone like him." They usually end up with being couple.

People use "FLAG" as a ridicule towards the noticeable pattern of story that occurs over and over again across Movies/TV episodes/Novels and so on.