It's a secret trap door in the piano that allows the pianist to
escape. No, no, no. Only kidding.
When you press a piano key, two things happen: (1) a damper moves away from the strings for that note so they can vibrate freely, and (2) a hammer strikes the strings.
Now, if the mechanical connection between key and hammer was a simple lever, then the hammer would strike the strings and remain in contact with them as long as you held down the key. That would prevent sustained vibration of the strings. Imagine the muffled "thunk" you would hear if, for example, you pressed your hand down on a guitar's strings and kept it there. To make a sustained sound, you need to touch the strings and then move away.
The piano's escapement mechanism is the clever solution to that problem. Just an instant before the hammer strikes the strings, it "escapes" its connection to the key so that it can strike the strings and then fall away from them, allowing them to continue to vibrate. It's almost as if the key "throws" the hammer, and the hammer bounces off the strings. Bartolomeo Cristofori is generally credited with inventing this mechanism and building the first pianos around 1710. The double escapement mechanism was invented by the Erard brothers in 1821, which allowed the same note to be repeated very quickly.