I think you are confused between the definition of any old function and a continuous function.
As you said, it is only for continuous functions that the fact
$$\lim_{x \to a} f(x) = f(a)$$
Any discontinuous function will not exhibit this behaviour.
As an example, consider $f(x) = \frac{1}{x}$ as $\lim{x \to 0+}$ (that is, approaching from the right hand side) versus $\lim{x \to 0-}$. I have put up the function here:

If you look at the graph of $\frac{1}{x}$, the function is discontinuous at $x = 0$. Morever, if we approach it from the left ($\lim{x \to 0-}$), then we get the values as "$-\infty$" (this is only conventional shorthand to say that diverges off to negative infinity. It does not "reach" infinity).
However, if we look at the graph from the right hand as $\lim x \to 0+$, then we get "$+ \infty$" (which, vice versa, means that the function diverges off to positive infinity)
Now, the graph of your function looks like this: WolframAlpha plot
So, in your question, you are asked to look at $$\lim_{x \to 1} f(x) = x |x - 1|$$
As you have verified, the limit $$\lim_{x \to 1} f(x) = 1 * |1 - 1| = 0$$ is equal to the value at $$f(1) = 0$$
This means that the function is continuous.
To get a better understanding of why this is a criteria for continuity, think of what is happening. The condition is basically saying that in the smallest of regions, the value at the point $a$ of the function $f$ should be same in the smallest region around $a$. This does not give the function a lot of wiggle room, and is hence forced to be "close to each other" at small intervals, thereby ensuring what we see as continuity.