Step 1: Understand the equation.
We are given a first order differential equation in $x$ and $y$ and must pick its general solution. The smart approach here is to guess that the answer has the form $y\sin\left(\frac{y}{x}\right) = k$ and check it, since checking is far easier than solving from scratch.
Step 2: Take the trial solution.
Suppose \[ y\sin\left(\frac{y}{x}\right) = k, \] a constant. We differentiate both sides treating $y$ as a function of $x$, and the right side gives $0$.
Step 3: Differentiate using the product rule.
Let $u = \frac{y}{x}$. Then \[ \frac{d}{dx}\Big(y\sin u\Big) = y'\sin u + y\cos u\cdot u'. \]
Step 4: Differentiate the inside part.
Here $u = \frac{y}{x}$, so by the quotient rule \[ u' = \frac{y'x - y}{x^2}. \]
Step 5: Put it together and set to zero.
So \[ y'\sin u + y\cos u\cdot\frac{y'x - y}{x^2} = 0. \] Multiplying through and grouping the $dx$ and $dy$ pieces reproduces the form $\left(\frac{y}{x}\right)\cos\left(\frac{y}{x}\right)dx - \left[\left(\frac{x}{y}\right)\sin\left(\frac{y}{x}\right) + \cos\left(\frac{y}{x}\right)\right]dy = 0$ given in the question.
Step 6: Conclude.
Since the trial expression satisfies the equation, the general solution is \[ \boxed{y\sin\left(\frac{y}{x}\right) = k} \]