First find the derivative of the solution.
dy/dt = -cos(t) + tsin(t) - 1
Now plug everything in and confirm that this is a solution. Also confirm the initial value.
t[-cos(t) + tsin(t) - 1] = -tcos(t) - t + t2sin(t)
Using distribution on the left side, we get -tcos(t) + t2sin(t) - t. This equals the right side, so first part is done.
y(π) = -πcos(π) - π = -π(-1) - π = π - π = 0
Since both parts check out, this is a solution to this differential equation.
-