We know that we should get the same thing for both sides of the differential equation. Since the right-hand side is zero, this means we should get zero for the left-hand side. Let's see if that happens.
If f (x) = sin x then f '(x) = cos x and f(2)(x) = -sin x. The left-hand side of the d.e. is
f(2)(x) + f (x) = (-sin x) + (sin x) = 0.
Since the two sides of the d.e. are equal when f (x) = sin x, we have shown that f (x) = sin x is a solution to this differential equation.