Let us first see what is continuity. Given a positive $\epsilon$, continuity of $f$ means that at each $x$, we can find a small $\delta$ such that $x'\in (x-\delta,x+\delta)$ implies $f(x')\in (f(x)-\epsilon,f(x)+\epsilon)$. So around each $x$, we have a small open set that is mapped very close to $f(x)$. Also note that points in the same small open set are mapped to points close to each other, since they are both mapped to points close to $f(x)$. But the problem here is that this radius of the open sets $\delta$ depends on the point $x$.
Now compactness means you can find a finite collection of such small open sets that they cover the support of the function, and this is good enough for us. Because among these finitely many open sets, you can determine the smallest radius, say $r$. If the distance between $x$ and $x'$ are less than $1/10r$, then you know they must lie in the same open set, then $f(x)$ and $f(x')$ must be close. Now this $r$ does not depend on $x$, you have uniform continuity.
If a metric space $X$ is non-compact then $X$ has a countably infinite closed discrete subspace Y. Because if $(p_n)_{n\in \mathbb N}$ is a Cauchy sequence in $X$ with no convergent subsequence, let $Y=\{p_n:n\in \mathbb N\}.$
We show that if $(X,d)$ is connected and non-compact then there is a continuous $g:X\to \mathbb R$ that is not uniformly continuous.
Let $Y=\{y_n:n\in \mathbb N\}$ be a closed discrete subspace of $X$ such that $m\ne n\implies y_m\ne y_n.$ For each $n$ let $r_n=\inf \{d(y_n,y_m):m\ne n\}.$ We have $r_n>0.$ Let $s_n=\min (1/n, r_n/6).$
Let $f_n:X\to [0,1]$ be continuous with $f(y_n)=1,$ and $f(x)=0$ for all $x\in X$ \ $B_d(y_n,s_n).$
The triangle inequality and the def'n of $r_n$ imply that for any $x\in X$ there exists $t_x>0$ such that there is at most one $n$ such that $B_d(x,t_x)\cap B_d(y_n,s_n)\ne \phi.$ So $f_n(x)\ne 0$ for at most one $n.$ So $g(x)=\sum_{n=1}^{\infty}f_n(x)$ is defined.
For brevity (of subscripts) let $U_x=B_d(x,t_x).$ Now $g(x)$ is locally continuous: For each $x\in X$ the function $g|_{U_x}$ is either constantly $0$ or is $f_n|_{U_x}$ for some (unique) $n.$ Local continuity everywhere is equivalent to continuity. So $g$ is continuous.
Now $X$ is connected so each non-empty open set $B_d(y_n,s_n)$ is not closed. (Its complement is not empty as it contains $y_{n+1}).$ So let $z_n$ belong to the boundary of $B_d(y_n,s_n).$ We have $g(y_n)=f_n(y_n)=1$ and $g(z_n)=f_n(z_n)=0$ but $d(y_n,z_n)=s_n\leq 1/n.$ So $g$ cannot be uniformly continuous. QED.
APPENDIX: To prove that for $x\in X$ there exists $t_x>0$ such that there is at most one $n$ such that $B_d(x,t_x)\cap B_d(y_n,s_n)\ne \phi:$
Note that for $n\ne n'$ we have $r_n\leq d(y_n,y'_n)\geq r_{n'}$ so $d(y_n,y_{n'})\geq \max(r_n,r'_n).$
(1). If $n\ne n'$ then $B_d(y_n,s_n)$ and $B_d(y_{n'},s_{n'})$ are disjoint, because if $z$ is in both of them then $$0<\max (r_n,r_{n'})\leq d(y_n,y_{n'})\leq d(y_n,z)+d(z,y_{n'})<s_n+s_{n'}\leq r_n/6+r_{n'}/6\leq$$ $$\leq \max (r_n,r_{n'})/3$$ a contradiction.
So if $x\in B_d(y_n,s_n)$ for some $n,$ we can take $t_x>0$ where $t_x$ is small enough that $B_d(x,t_x)\subset B_d(y_n,s_n).$
(2). If $x\not \in B_d(y_n,r_n)$ for any $n,$ let $t_x=(1/3)\inf \{d(x,y):y\in Y\}.$ We have $t_x>0$. Suppose by contradiction that $n\ne n',$ with $a\in B_d(y_n,s_n)\cap B_d(x,t_x)$ and $b\in B_d(y_{n'},s_{n'})\cap B_d(x,t_x).$ Then $$d(y_n,y_n')\leq d(y_n,a)+d(a,x)+d(x,b)+d(b,y_{n'})<s_n+2t_x+s_{n'}\leq$$ $$\leq r_n/6+2t_x+r_{n'}/6\leq 2t+d(y_n,y_{n'})/3$$ which implies $t_x\geq d(y_n,y_{n'})/3\geq r_n/3\geq 2s_n.$ This implies $$d(x,y_n)\leq d(x,a)+d(a,y_n)\leq t_x+s_n\leq t_x+(t_x/2)<2t_x.$$ So $y_n\in B_d(x,2t_x),$ contradicting the def'n of $t_x.$
Best Answer
The second sentence shows you the property that $\delta_x$ must satisfy, given $x \in K$. For each $x \in K$, you now have an associated $\delta_x > 0$ such that $$y \in (x - \delta_x, x + \delta_x) \implies |f(y) - f(x)| < \frac{\varepsilon}{2}.$$ The proof goes on to call the interval $(x - \delta_x, x + \delta_x)$ by the name $I_x$. So, for each $x \in K$, you also have an interval $I_x$, containing $x$. So, using $K$ as an index set, you have a family of open sets $(I_x)_{x \in K}$ with the union containing $K$. We need this to use compactness.
Compactness implies the existence of a finite subcover of this open cover. There must be a finite subset of points from $K$ (i.e. a set of the form $J = \{x_1, \ldots, x_m\} \subseteq K$ for some $m$) such that $$K \subseteq \bigcup_{x \in J} I_x = \bigcup_{n = 1}^m I_{x_n}.$$
But remember, we have $\delta_x$ associated to any given $x \in K$, including the elements of $J$! As such, we have a $\delta_{x_n}$ associated to $x_n$ for all $n = 1, \ldots, m$.
You could also think of $\delta_{x_n}$ as half the diameter of $I_{x_n}$, if that helps.