Let us choose two points $x_1, x_2\in X$. Every point of $[x_1, x_2]$ can be written as $tx_1+(1-t)x_2$ with $t\in[0,1]$. Now, the line that goes through the points $(x_1, f(x_1))$ and $(x_2, f(x_2))$ has the equation
$$(x,y)=(x_1, f(x_1)) + t[(x_2, f(x_2))-(x_1, f(x_1))]$$
or, in other words
$$y= \frac{f(x_2)-f(x_1)}{x_2-x_1}x + \frac{x_2f(x_1)-x_1f(x_2)}{x_2-x_1}$$
and if you pick $t\in[0,1]$, you obtain the points of the segment between $(x_1, f(x_1))$ and $(x_2, f(x_2))$.
As you know that the line is above the graph of $f$, then the $y$ coordinate of the point $(x,y)=t(x_1, f(x_1)) + (1-t)(x_2, f(x_2))$ has to be greater than $f(tx_1+(1-t)x_2$. This way, you obtain the inequality of the definition:
$$f(tx_1+(1-t)x_2)\leq tf(x_1)+(1-t)f(x_2)$$
Note that, when you fix two points $x_1$ and $x_2$, the inequality is only valid for the points between $x_1$ and $x_2$. For example, let us call $f(x)=x^2$, which is convex. If you fix $-1$ and $1$, for the points outside $[-1,1]$ the inequality does not hold.

Another example with the points $-2$ and $1$. Now the line is obviously different, but the inequality is again true only for the points in $[-2,1]$.
The thing is that you can choose $x_1$ and $x_2$ in all $\mathbb R$, you have no restriction in that. But, once chosen, the inequality would be only valid for the points between.