You assumed w
to be real in the previous input, but Mathematica does not remember that. There are various ways to get what you want:
Im[x + I*y]
ComplexExpand[Im[x + I*y]]
Simplify[Im[x + I*y], Element[x | y, Reals]]
Assuming[Element[x | y, Reals], Refine[Im[x + I*y]]]
$Assumptions = Element[x | y, Reals]
Refine[Im[x + I*y]]