Why was trench warfare used despite the amount of casualties and injuries caused by it?It seems crazy that the best way of fighting was getting your men across a muddy field while the enemies picked you off.
During the opening phase of world war one both sides used mobile armies like had been done historically. The Germans pushed through Belgium and Luxemburg into northern France and the French pushed into Alsace-Lorraine. In both cases they were attacking enemy armies and suffering absolutely staggering casualties from machine guns, artillery, and modern rifles (mostly the first two though).
Despite the casualties the German push managed to advance pretty far into France before the "battle of the Marne" happened and the now Franco-British line pushed back against them and then stabilized as German troops dug in. In the south the German army defending against the French push was able to counterattack and drive the French almost completely out of Germany before the French began to dig in.
As you can see, neither side initially wanted trench warfare, but as artillery and machine guns we're absolute death above the ground and both sides had areas they needed to protect and hold onto their troops did the only thing that made sense: dig in. Trenches are older than WW1, but this was the first time Western powers had an entire front lined in trenches instead of being a more tactical than strategic defensive work.
Both sides tried to get around each other's flank using mobile armies and this eventually led to the "race to the sea" when the Franco-British and German forces ran out of room to maneuver. the entire Western front slowly calcified until the deployment of more modern tactics in 1917-18.
None of this happened on the Eastern front however. The massive Russian front was simply to large and fluid for static defenses to make much sense so mobile war continued there and on.many other fronts like the middle eastern campaigns by the British imperial troops (excluding Gallipoli) and the turkish-russian front near the Caucasus.
It was a brief period in history when there really was no effective mobile force faster than infantry.
Cavalry were traditionally used to exploit gaps and routs of troops, but such concentrated amounts of artillery and small arms fire made it suicidal to use them. The tank would not really fulfill this role until very late in the war and much more in WWII.
The huge size of the armies on the Western Front made it possible for the first time to almost literally wall off the entire front, making flanking difficult to impossible. So the defenders’ advantage was practically insurmountable.