If $E$ is an infinite subset of a compact set $K$, then $E$ has a limit point in $K$
Each $q \in K$ has a neighbourhood $V_q$ that contains only finitely many points of $E$. The family $\left(\overset{\circ}{V}_q\right)_{q\in K}$ is an open cover of $K$, hence has a finite subcover, since $K$ is compact.
That contradicts the fact that $E$ is infinite, since any finite subfamily of the $V_q$ can only cover finitely many points of $E$.
Definition: A set $K$ is compact if whenever $\mathscr{U}$ is a family of open sets that covers $K$, then some finite subfamily of $\mathscr{U}$ covers $K$.
Here $\mathscr{V}=\{V_q:q\in K\}$ is a family of open sets covering $K$, and $K$ is compact, so by the definition of compactness some finite subfamily of $\mathscr{V}$ must cover $K$. But the argument shows that this is not the case, so we have a contradiction.
It’s possible that you’ve been given some other definition of compactness rather than the standard one. If so, however, you should already have seen a proof that it implies the standard definition that I gave above.