First, multiply both sides by (x - 5), so you end up with:
(x-5)y = x + 2
Which can be expanded to give you:
xy - 5y = x + 2
Now add 5y to both sides to obtain:
xy = x + 2 + 5y
Now subtract x from both sides:
xy - x = 2 + 5y
Factorise x out:
x(y - 1) = 2 + 5y
Divide both sides by (y - 1):
There you go, x is now the subject.