I don't get how I got it right. I have a test upcoming and I am really confused

You have a system of linear equations. For solving this question, you can apply the addition method.
In this method, we try to cancel one of the variables x or y. Let`s go!
Now, you should replace the value found for x in any equation for finding y.
Answer
x=5 and y=-2