Well the powers of Europe got together in a conference hall, had some quiche and crackers then had a lengthy discussion about the type of warfare they could fight with and decided on the deadliest and least efficient form of waging war in history that would destroy both of their countries populations for decades.
Heh, sorry, just pulling your leg there. The progression into trenches was a natural escalation. The start of the war was actually noted by rapid deployments and maneuver based warfare, particularly in North France. Cavalry, light artillery, and (successful but deadly) mass infantry charges were the name of the game and I could ramble on for an entire post on itself of the many great maneuvers and attacks and decisions made by both French and German general staffs. The issue came in September, 40 days into the start of the war. The French were pushed back just a few kilometers on the outskirts of Paris and the French were on the brink of destruction. The last 40 days of defeat was not, however, a total route but an organized and methodical retreat. Like one German officer on the ground said (to paraphrase) -- there were too few casualties, too few prisoners, too few guns captured. They hadn't broken the French, despite the General Staff's constant harping about their "Second Cannae".
The French had spent those 40 days using their extensive rail networks to move troops into Paris for what they thought would be the siege to end all sieges and to perform a glorious defense -- stockpiling 460 battalions which would comprise the French Sixth's Army. This would number well over half a million men -- men the Germans thought were not there as they believed Paris to have long ago become a ghost town in the face of present, "unstoppable" danger. The Germans thought all the French army were in front of them, on their heels on the retreat and they were about to crush them all (well, the higher officers at least).
The French also used this time to destroy rail networks wherever the Germans were conquering making it near impossible for them to lug around their rail based heavy 150mm and 205mm artillery. When these factors combined, the Germans approached a series of rivers which would empty out into what is known as the Marne. They would assume, Paris being empty, they needed but one final strike against the French and turned their backs toward Paris -- home to over half a million Frenchmen waiting to defend who now had the opportunity of a lifetime. The Germans would be also split up by their maneuver -- the First Army was to go around North of Paris and the Second and Third Armies were to go South to continue the pursuit. Kluck's First Army of 128 battalions of infantry and 748 guns would be matched against 191 infantry battalions and 942 guns. But where the real action happened was Bulow's Second Army and Hausen's Third Army whose combined 134 battalions would fight a battle on two sides -- from the French who were previously "on their heels" and the Parisians pouring out. 134 battalions and 844 guns would face double that amount precisely -- 268 battalions and 1084 guns. All supported directly by their country and their homeland, while the Germans were at half strength in many places and were relying on donkey carriage.
The Germans would be crushed. The only thing worse than the risk of total encirclement of their 1st, 2nd, and 3rd Armies and their subsequent total and crushing retreat would be the feeling in the war rooms around Germany. I can not express enough how much these men thought they were on the brink of victory. Their second Cannae, they were about to repeat what their fathers had done 40 years prior in the Franco-Prussian War and then some. Who doesn't want to show up their fathers achievements? Be "them but better"?
The Germans would retreat near the border of Belgium and dig in to finally stop the French onslaught. The French would also dig in to stop any potential of a German counter attack and then both sides desperately tried to outflank the other. The "Race to the Sea" as it is commonly called was both armies literally racing parallel to each other as fast as they possibly could to try and get around each other and restart mobile warfare. The French wanted to crush the Germans once and for all and push them back into Germany. They would both literally reach the sea as the name implies and have no avail -- those lines they drew as they raced each other would be more or less the lines for the remainder of the war. Not because of some meeting in a shady room but because that's just how it developed.
Why was "digging in" so valuable? Because the defensive toys had surpassed the offensive ones, is the short answer. Machine guns were absolutely deadly on mass infantry formations. The solution to a machine gun being plastered in your face without something like, say, armor to protect you? You dig a hole. They start launching artillery AND machine guns at you all day? Dig a deeper hole. Everyone is in holes now? Connect those holes. Now that you're living in these networks of connected holes you may as well reinforce them with wood and iron and sandbags and concrete because we're going to be here for a while -- their hole is a bit too strong to attack today. Something seemingly innocent like barbed wire -- used to herd cattle prior -- becomes an invaluable tool in preventing enemy assaults in combination with your machine guns.
It's not like both sides didn't want a mobile war to begin again. That was the goal the entire time of the war. It's just, how do you initiate one? Do you breach their trenches and send them off with their tails behind their legs? That requires breaking through their defenses and being routed in the first place which is something neither side wanted to happen to themselves. Thus more sophisticated defenses were created and as the war went on, so did the depth of the defenses. While in '14 we had a bunch of shoddily dug trenches filled with mud and grime and water that collapsed on themselves and had machine guns haphazardly thrown on top, '17 and '18 saw a completely different war. You would have a bunch of shoddily dug "front line trenches" filled with mud and grime and water that collapsed on themselves that was meant to be a constant 'probe' on the enemy while being backed up by sophisticated and well built trenches with presighted artillery and machine guns and mines and barbed wire formations that went hundreds of yards deep at times. You had complex underground tunnel systems meant to get under the enemy trenches and sabotage them with explosives and to safely resupply forward trenches as well.
By 1918 it became apparent to all parties that artillery could not obliterate an enemy trench by itself. They didn't need to have all their men up front at once so you would just be firing at empty trenches most of the time. You'd charge through those barbed wire formations that were only partially destroyed by your artillery while being hacked down by snipers and machine gun nests and they would just let you have the first few trenches and counter attack with their own infantry with a 3:1 advantage on their own turf. They would take back their stuff in a matter of hours after a major attack, resecure it, and spend the next few days refortifying it. That was basically life on the trenches -- constantly dealing with refortifying the front and maintaining the integrity of the trenches waiting for the next big attack.
By this time artillery doctrine would be refined from being brute force and meant to destroy the enemy independently but as a supporting arm of the infantry. It would be precise, sudden, and over in a matter of minutes. It would combine with new inventions like the tank and the flame thrower and the personal mortar. Air power had refined itself into a competent reconnaissance wing and went from firing pistols at each other from air into becoming active participants in battles by acting as precision bombers. They would use these new technologies and artillery doctrine in tandem with new infantry doctrine, infiltration tactics, also known as Hutlier Tactics after the German General who developed it. Small squads in the dead of night operating independently across "No Mans Land" to infiltrate the enemy trenches and cause chaos and create weak points for the armor and flamethrower crews and mortar crews to work into and further widen the gaps for the regular infantry to attack.
This would create a period of unprecedented mobile warfare for the war since August 1914 as the Germans would push dozens of miles into France and a Second Battle of the Marne would occur -- with another French victory. The Entente would then push the Germans back to their original positions and then, spectacularly, roll the infamous Hindenburg Line over on itself like it was hot butter. This famous German defensive line of sophisticated trenches and mine fields and enormous barbed wire formations and tens of thousands of machine guns and thousands of artillery placements would basically be marched through in the Hundred Days Offensive like it wasn't even there. Trenches were, essentially, now useless in the face of modern warfare as doctrine and technology "caught up." Although infiltration tactics would become less crucial in the face of modern, mechanized warfare the doctrine would still play a central role in WWII military's and live on to this day.
I pull 95% of my knowledge about war operations and life from the first two sources, I highly recommend them. There are alternative sources for the British and Germans I can also provide though if you want more specialized for those.
Simpson, Andy Hot Blood & Cold Steel: Life and Death in the Trenches of the First World War
Doughty, Robert Pyrrhic Victory: French Strategy and Operations in the Great War
Herwig, Holger The Marne, 1914: The Opening of World War I and the Battle That Changed the World