Consider two persons $A$ and $B$ and $B$ is moving with velocity $+0.6c$ in $+x$ direction.
Take the frame $S$ in which A is at rest but $B$ appears to move in the $+x$ direction with velocity $0.6c$. $S'$ is the frame in which $B$ always is at rest and is at origin.
So, $\gamma=\frac{1}{\sqrt{1-\frac{v^2}{c^2}}}=\frac{1}{\sqrt{1-0.36}}=\frac{1}{0.8}=1.25$
Event-1 Origin of $S$ and $S'$ are coinciding at $t=t'=0$.
So, $$x_1=0,t_1=0$$
$$x_1'=0,t_1'=0$$
Event-2 $B$ reaches at point $P$ which is at $x=3\;light\;years$
$$x_2=3ly,t_2=\frac{3ly}{0.6c}=5\;years$$
In $S'$ frame, $B$ always is at rest and see the point $P$ to coming towards it by velocity $0.6c$
$$x_2'=0,t_2'=?$$
By Lorentz transformation,
$t_2'=\gamma\Big(t_2-\frac{vx_2}{c^2}\Big)$
$t_2'=1.25(5yr-(0.6\times3)yr)$
$\implies t_2'=1.25(3.2)=4yr$
So, in $S'$ frame after $4yr$, P reaches the origin of $S'$.
Now we can get the same result using Lorentz contraction,
$Length\;OP$ in $S'$ frame=$\frac{Length\;OP\;in\;S\;frame}{\gamma}=\frac{3ly}{1.25}=2.4ly$
So, Time taken by far end to reach the origin in $S'$=$\frac{2.4ly}{0.6c}=4yr$
Event-3
Now suppose if I am interested in finding out the position of origin of $S$ in $S'$ when $B$ reaches $P$
$$x_3=0,t_3=5yr$$
$$x_3'=?$$
$x_3'=\gamma(x-vt)=1.25(-0.6c\times5yr)=-3.75ly$
But $Length\;OP$ in $S'$ frame=$2.4ly$. This means when the far end reaches $x'=0$ this means the other end reaches $x'=-2.4ly$.
The question is using Lorentz transformation, $x_3'=-3.75ly$. But by considering $OP$ as a rod and using Lorentz contraction, I get $x_3'=-2.4ly$.
Why this is so? And which one is correct? I am very confused.
Addendum
Basically the question is how the two events "position of $O$ in $S'$ frame when $P$ is at the origin of $S'$" and "position of $O$ in $S'$ frame when an event occurs at the origin of $S$ at $t=5ly$" are different?