Let m = the amount of money before buying the $25 gift.
He spent $25, so he ended up with m - 25.
We are told he ended up with $176.89, so m - 25 must equal $176.89.
We write an equation and solve for m.
m - 25 = 176.89
Add 25 to both sides
m = 201.89
He had $201.89.