Check the picture below.
if you notice your graph, and we plug a few x-values coming from the left, and then from the right, it'd be like in the picture.
now, notice that, the function y-value is a constant all the while as "x" is approaching 2 from the left, it looks like it's approaching 4, now, it will never get there, but is approaching it, for a limit, that's all that matters, even if the value is never reached.
and from the right, it looks like is approaching 2, it will never get there, but that is irrelevant for a limit.