What is the purpose of the 10kΩ resistor in this circuit?
It's a pull down resistor, its purpose is to set the voltage of the Arduino input to 0 V when the button is open. It just sets a default voltage value to the connected node.
But, why is such a resistor needed? Well, when the button is open, the voltage is not totally equal to zero due to antenna effects or surrounding components. It is then possible that the Arduino input is triggered for no reason.
Note that the value of pull up or pull down resistors is usually around 10k - 100k. If the value is too low, it's going to draw too much current when the button is closed. If the value is too high, the resistor will behave as an open circuit, making the pull down resistor useless.
As it is widely used in electronics, I recommend you to read some more about this concept.
This looks like a pull-down resistor.
a pull-[down] resistor is a resistor used to ensure a known state for a signal.
[They] are used in electronic logic circuits to ensure that inputs to the [microcontroller] settle at expected logic levels if external devices are disconnected or high-impedance. 'Just because you have nothing at all connected to an input pin doesn't mean it is a logical zero.'
[D]igital logic circuits have three logic states: high, low and floating (or high impedance). The high-impedance state occurs when the pin is not pulled to a high or low logic level, but is left “floating” instead. [...] a microcontroller might unpredictably interpret the input value as either a logical high or logical low. Pull-[down] resistors are used to solve the dilemma for the microcontroller by pulling the value to a logical [low] state
By the way, as your LED seems to lack a current limiting resistor, it will likely burn out pretty quickly, unless it has some integrated current limiting circuitry that is not visible in the drawing.
People tend to think that undefined is equal to zero. Compare it to something in a store that has no price label: customers will joke it is for free ($ 0.00), but it is not: the price is unknown.
It is the same with voltages/potentials. If you simply remove the resistor and the button is not pressed (not conducting) the potential on input 7 is not defined. It is tempting to say it will be 0V, but there is no reason for it to be. By connecting it to 0V (gnd) trough a (pull-down) resistor it suddenly is defined: there is no current (where would the energy come from), so the voltage over the resistor must be 0V as well. 0+0=0V.
If we replace the resistor with a short circuit (between the button and gnd) the voltage would be zero as well, as long as the button is not pressed (not conducting). But what would happen once you press the button? The left side of the button is at 5V, the right side at 0V (gnd). The result is a short circuit: the maximum current will flow from 5V to the gnd and you still do not have a defined voltage at input 7 (and on top of that things can get pretty warm).