It comes from the idea of using a fan to increase a fire. Just like a fan makes a fire burn hotter, someone who is fanning the flames is making a conflict, argument, or negative situation more intense and potentially dangerous.
Here are some examples:
* "The politicians are fanning the flames of hatred by spreading misinformation about their opponents."
* "The media's constant coverage of the scandal is only fanning the flames of public anger."
* "He's just fanning the flames of the argument by refusing to apologize."
The idiom suggests that the person fanning the flames is deliberately trying to make the situation worse, often for their own benefit.