Question :-
A block is attached to the free end of a spring of spring constant $50\ \mathrm{N/m}$. Initially the spring was at rest. A $3\ \mathrm N$ force was applied to the block until it came to rest again. Find the maximum displacement of the block, take initial displacement as $0$.
My first try :-
We know the spring force is $-kx$.
So at rest only horizontal forces acting on the block would be spring force and applied force of 3 N.
$$\therefore -kx + 3N = 0$$
$$\implies x = \frac 3{50} = 0.06\ \mathrm m$$ Which is incorrect.
My second try :-
Let work done by spring force and applied force be $W_s$ and$ W_a$ respectively.
$$ \begin{aligned} \Delta E_k &= W_s + W_a\\ &\implies0 = \displaystyle -\frac12 kx^2 + Fx\\ &\implies\displaystyle \frac12 kx = F\\ &\implies\displaystyle kx = 6\\ &\implies\displaystyle x = \frac{6}{50} = 0.12\ \mathrm m \end{aligned} $$
Which is correct.
I am still not getting why my first try failed. What was my error ?