You can always easily arrange
that your opponent's move, followed by yours that follows, removes a total of 4 flags.
Therefore,
if the number of flags is not a multiple of 4 you can use your move to make it a multiple of 4, and from then on your opponent can never (and you will always) reduce the number to a multiple of 4. In particular, it must be you rather than your opponent who takes the number down to 0.
So
with 25 flags, the first player (in this case A) will win; with n flags, the first player will win if n is not a multiple of 4 and the second player if n is a multiple of 4.
[EDITED to add: The following remarks about the 3-player version of the game were written before the OP changed the question to specify that a player who will definitely not win takes the maximum number of flags. Presumably we are to understand that this policy is common knowledge too. This of course invalidates what I wrote below.]
I think the main thing to say about the 3-player version is this:
The player who wins may not be completely determined given only that each player maximizes their own winning opportunities, because there might be situations where A can't win but can choose whether B or C wins (e.g., this is the case if it's A's turn and there are exactly 5 flags remaining: if A removes 1 then C will win, else B will). So the result depends on each player's preferences between the other players.
Let's be more specific. I'll call the players 0,1,2 and suppose 0 has just played and 1 is about to. We can see, considering successively larger numbers of flags, that
with 0 flags, 0 has just won
with 1-3 flags, 1 is about to win
with 4 flags, 2 will win
with 5 flags, player 1 chooses between 0,2 winning
with 6 flags, 1 will take one and then 2 chooses between 0,1 winning (the other options lead to situations where 1 will definitely not win)
with 7 flags, if 1 takes one then 0 chooses between 1,2 winning; if 1 takes two then 2 chooses between 0,1 winning; 1 will not take 3 because then 0 definitely wins
and so, in particular,
the winner even for rather small n may depend on something as subtle as whether player 1 thinks it more likely that 0 prefers 1 over 2, or that 2 prefers 1 over 0.
As n increases
the outcome will depend on increasingly multi-level considerations about whether A expects B to expect C to expect A to prefer B to C, etc. I'm pretty sure that for $n\geq7$ there are possible scenarios where any given player wins (even though in each such scenario, no player ever makes a choice that's unambiguously worse than another they could have made).