In Thronebreaker: The Witcher Tales, Geralt helped Meve, the queen of Lyria and Rivia, to fight the Nilfgaardians. I expect witchers tend to be neutral in wars and don't kill humans unless humans want to kill witchers (except for witchers from some schools such as Viper or Cat). Witchers are trained to slay monsters, not humans. Besides, nobody asked Geralt to help Meve although she was outnumbered by the blackclad army. So, why did he help her?
They tried to avoid the fight, but couldn't. Then fought because they didn't have any other option and couldn't abandon Milva, who was wounded. To quote Geralt (from Baptism of Fire):
"I don't give a shit about this war", the Witcher said, grinding his teeth. "This is about Milva"
The game is mostly in line with the books here. Meve was fleeing from the Nilfgaard army chasing them, on the Nilfgaardian bank of the Yaruga, near Ysgith.
Geralt's party had heard that there were Lyrian partisans in the area, but also Nilfgaardians. They had decided to cross the river using a ferry, to avoid getting tangled up in the conflict, instead, they end up doing the opposite.
In the game there is a barge, on Meve's side on the river, which the Lyrians find stolen. This goes somewhat against the books - in the books, Geralt's party is crossing the river on a rope ferry heading towards Meve. But as they are halfways across, they spot the Lyrians fleeing from Nilfgaard. The Lyrians had probably hoped to use the ferry - they desperately try to catch it in order to get the Queen to safety. When Geralt's party refuse to cross the river to meet them and instead cut the ropes of the ferry, the Lyrians even fire arrows at them.
So instead of crossing, Geralt's party fight the current and keep the ferry to the middle of the river. Meanwhile, Nilfgaard troops arrive on the the bank they came from, also starting to shoot at the ferry. This time Milva returns the fire and kills several, including a Nilfgaard officer. So now both sides want them dead. They keep the ferry in the middle of the river, avoiding both sides.
It turns out that Nilfgaard had laid a trap for Meve, with troops of both sides of the river. So accidentally, Geralt's party actually saved Meve from that trap.
But down the river, they come to a shallow bridge which the ferry can't cross. At the same time, Meve's troops has made it for that bridge, hoping to cross it to escape. But once on the bridge the Lyrians are trapped between the two Nilfgaard forces.
The ferry gets stuck at the bridge and Milva gets shot by an arrow - she was pregnant and is miscarrying, so Regis has to tend to her right there below the bridge.
Cahir, who is an officer, comes up with the idea to rally various Lyrians fleeing across the bridge, to strike back. Geralt and Cahir fights together with the Lyrians in order to save themselves and Milva.
In the game as in the books, Geralt and Cahir appears out of nowhere without explanation, saving the day. Meve doesn't realize that Geralt's party was the same one that were on the ferry. Count Odo, speaking to Geralt (from Baptism of Fire):
And you saved her and our corps. After some traitors had captured and hijacked the ferryboat, that bridge became our only hope
It wasn't a political decision - Geralt and his crew were looking for Ciri, they needed to get around the Nilfgaardian army, they accidentally stole Meve's boats, and ended up right in the thick of the battle. Geralt continued to fight because he thought the battle was his baptism of fire (found here)