Step 1: Look at the equation.
We have $\left(x\frac{dy}{dx}-y\right)\sin\frac{y}{x}=x^3 e^x$. The piece $x\frac{dy}{dx}-y$ and the term $\frac{y}{x}$ are a strong hint that $\frac{y}{x}$ should be treated as one quantity.
Step 2: Recall a handy derivative.
By the quotient rule, \[ \frac{d}{dx}\!\left(\frac{y}{x}\right)=\frac{x\frac{dy}{dx}-y}{x^2}. \] So $x\frac{dy}{dx}-y$ is just $x^2$ times the derivative of $\frac{y}{x}$.
Step 3: Divide to reveal that pattern.
Divide both sides of the equation by $x^2$: \[ \frac{x\frac{dy}{dx}-y}{x^2}\sin\frac{y}{x}=x e^x. \] The left side now starts with $\frac{d}{dx}\!\left(\frac{y}{x}\right)$.
Step 4: Substitute one new letter.
Let $v=\frac{y}{x}$. Then the equation becomes \[ \sin v\,\frac{dv}{dx}=x e^x, \] so $\sin v\,dv=x e^x\,dx$. The variables are now separated.
Step 5: Integrate both sides.
Left side: $\int\sin v\,dv=-\cos v$. Right side: $\int x e^x\,dx$ needs integration by parts with $u=x$, $dv=e^x dx$, giving $x e^x-\int e^x dx=x e^x-e^x$.
Step 6: Combine the results.
\[ -\cos v=x e^x-e^x+C_1=e^x(x-1)+C_1. \]
Step 7: Put $v=\frac{y}{x}$ back and tidy up.
Move everything to one side: \[ e^x(x-1)+\cos\frac{y}{x}+c=0. \] This is option (1).
\[ \boxed{e^x(x-1)+\cos\dfrac{y}{x}+c=0} \]