For your first question.
Can you explain what is $ doing there?
Ans:
The $ special character identifies a string literal as an interpolated string. An interpolated string is a string literal that might contain interpolated expressions. When an interpolated string is resolved to a result string, items with interpolated expressions are replaced by the string representations of the expression results. This feature is available in C# 6 and later versions of the language.
You can read more about interpolation here
For your second question.
I tried to run it but it showed a compilation error.
Ans:
Remove the space from here
return $ "({x},{y})"
^
So it becomes
return $"({x},{y})";
If you are using c# version below than 6 then this will be same as interpolation.
return string.Format("({0},{1})", x, y);