Assuming the system loses (or receives) no heat to the environment (assume it's an isolated system), then both water and metal will end up at the same temperature, say $T_3$, given enough time. As per Thermodynamics, heat exchange between metal and water continues until their temperature difference is $0$.
With $m_m$ the mass of metal, $c$ its heat capacity and with $m_w$ the mass of water, $c_w$ its heat capacity, the heat balance then becomes:
Extract $c$ easily from there:
No heat was lost or gained, only exchanged.
Note that heat capacity of most materials is somewhat temperature dependent, so the value of $c$ obtained this way is an average over the temperature interval $(T_1,T_3)$. If the temperature dependence was known as a function $c(T)$ then that average over $(T_1,T_3)$ would be found as:
A slightly reformulated way of doing this is as follows.
The heat lost by the metal is:
Similarly, the heat gained by the water is:
Since there no heat is lost or gained (isolation assumption), both are identical, so that:
Isolate $c$ and get the same result as above.