Conserved quantities in GR
In GR, energy (or mass) is typically an ill-defined concept. In flat spacetime, we define energy as the conserved quantity corresponding to time translational symmetry. Extending this to GR is quite tricky mainly because, what one is calling time is already observer dependent (this is of course also true in flat spacetime, but at least there we have a canonical definition of time given by inertial observers). A second problem in GR is that time translation may not be a symmetry of the space-time, making it impossible to define energy. In particular, recall that the metric in GR is a fluctuating field, which makes it doubly hard to define timelike Killing vectors when the background itself is fluctuating.
Anyway, I hope what you can get from this is that defining energy and in fact any conserved quantity that depends on isometries of the space-time is not really something one can talk about in general relativity. So what do we do? How do we define such quantities?
How to define energy in GR?
One possible solution is to go very very far away from all forms of matter in a region where only radiation may exist. In this region - known as asymptotic infinity - spacetime is approximately flat, and one may hope to define energy here. In this region, we have a well defined notion of inertial observers w.r.t. whom we may define time and hence energy. The energy/mass so defined is called the ADM (Arnowitt, Deser, Misner) energy of the space-time. It describes the mass of the system as measured by an inertial observer sitting at infinity.
ADM mass of the Schwarzschild Black Hole
The precise formulae for the ADM mass can be read off for instance in Carroll. Using that formula, we can compute the ADM mass of the Schwarzschild black hole and we find that it is $M$. This is how we know that the quantity $M$ represents the mass of the Schwarzschild Black Hole. In other words, the statement is, place an inertial observer very far away from the black hole and ask him/her to measure the energy of the system which he/she will do w.r.t. the time that he/she is experiencing. The result they will find is that the energy of the system $=M$.
A caveat here is that they must make sure that they are themselves at rest w.r.t. the black hole. There is a wide class of inertial observers at infinity, some (actually, most) of which are moving relative to the black hole. We would like to define mass as the energy of the system at rest. Thus, we must choose our inertial observer so that the momentum that he/she measures is zero. In this frame, the energy that he/she measures will be the mass. When this is done for Schwarzschild, the answer we get is $M$.
A side note
The ADM mass is what we would typically like to call mass of a system, except that it lacks in one respect. An inertial observer at infinity, is not able to measure energy in gravitational or electromagnetic radiation that is emitted. For instance, if the Schwarzschild black hole were to start radiating energy via gravitational waves and eventually disappear, the ADM mass measured by the observer at infinity would still be $M$.
When gravitational radiation is important (for instance, when studying scattering of gravitational waves) for the problem, a more convenient definition of the mass is the Bondi mass $m_B$ which is defined as the mass measured by a Bondi observer at infinity. A Bondi observer is one that moves at the speed of light along null infinity. The Bondi mass is a function of (null) time $m_B(u)$ so that it captures not only the current mass, but also the change in the mass of the system due to radiation.