Brought on by the aggressive tactics of General Hermann von Francois in defense of the German province of East Prussia, the battle was completely unexpected by both sides, along with its outcome.
In mid-August, 1914, the Russian army began to execute an invasion of East Prussia at the outbreak of hostilities. At the easternmost extremity of Germany, Russian General Pavel Rennenkampf invaded East Prussia with the Russian First Army, with the city of Königsberg as his ultimate target.
The Germans expected this, and opened the war in a defensive posture because massive attacks against France on the Western Front were drawing down most of the German troops. However, Francois, the commander of the First Corps of the German Eighth Army, was convinced his better trained and equipped forces could slow down, if not halt, Rennenkampf's Russian forces.
On August 17, Francois brought on a general engagement with the advancing Russians in spite of orders from his theatre commander, General Maximilian von Prittwitz to withdraw if pressed. When Prittwitz learned that Francois had engaged the Russians, he sent an adjutant to order Francois to break off the attack and retreat. Francois by this time was too committed to safely disengage, and had no intention of doing so anyway. He contempuously, and famously, told the adjutant that "General von Francois will withdraw when he has defeated the Russians!"
With the outcome hanging in the balance, Francois ordered a general attack all along the line and hammered the Russians' vanguard, inflicting 5,000 casualties and taking 3,000 prisoners. While the Russians retired to the border to lick their wounds, Francois reluctantly obeyed Prittwitz' order and withdrew 15 miles to the west, taking a new position around Gumbinnen.