Why equating forces give wrong answer? 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 ?
 A: Your first try is considering a static system. So the result is true if you very very slowly increase the force until you reach 3N. (With the friction dampening all oscillatory motion of the mass)
So the real question is what is different in the problem you posted.
Try thinking it from the beginning, you switch on the force and initially it is much greater than the counter force of the spring. So the mass accelerates, building up kinetic energy. The part the work which is transformed into kinetic energy decreases until you reach 0.06m as you calculated in your first try. From now on the force is decelerating the mass until it comes to a rest. As you calculated this is 0.12m from its original position.
This scenario is dynamic, the mass will now oscillate around the center-point.
A: You say
"A  force was applied to the block until it came to rest again"
The block doesn't come to rest at x = 0.06 m, only acceleration becomes zero); it overshoots because of its non-zero velocity and comes to its instantaneous 
rest (instantaneous speed zero) at x=0.12 m. So for your question, (b) is the correct answer. Of course there are two answers in your part (b), x=0 and x=0.12 - the block is at rest instantaneously at both places as it oscillates. But the maximum displacement is at x = 0.12 m.
