The desired property is called the existence of an exhaustion by compact sets for the space $X$. (see Wikipedia)
The answer of @bof holds in the context of locally compact Hausdorff spaces (since the OP mentioned metric spaces). But the result is more generally true for weakly locally compact spaces, that is, locally compact spaces in the weakest sense in that each point has a compact neighborhood.
Proposition: The following are equivalent for a topological space $X$:
- $X$ is exhaustible by compact sets.
- $X$ is $\sigma$-compact and weakly locally compact.
- $X$ is Lindelöf and weakly locally compact.
We need a preliminary
Lemma: In a weakly locally compact space $X$, for every compact subset $K\subseteq X$ there is a compact subset of $X$ containing $K$ in its interior.
To see this, every point $x\in K$ has a compact nbhd. Since $K$ is covered by the interiors of all these nbhds, it is covered by a finite number of these interiors, and the union of those finitely many compact nbhds is compact and contains $K$ in its interior.
Now the proof of the proposition.
(1) implies (2): Suppose $X=\bigcup_n K_n$ with each $K_n$ compact and $K_n\subseteq\operatorname{int}(K_{n+1})$. Clearly $X$ is $\sigma$-compact. Also the interiors of the $K_n$ cover $X$, so $X$ is weakly locally compact.
(2) implies (3): because $\sigma$-compact implies Lindelöf.
(3) implies (2): Since $X$ is weakly locally compact, every point is in the interior of some compact set. By the Lindelöf property $X$ is covered by the interiors of a countable number of these compact sets, and hence by a countable number of these compact sets themselves.
(2) implies (1): This is just a modification of the argument from @bof. Suppose $X=\bigcup_n C_n$ with each $C_n$ compact. Take $K_1=C_1$. The set $K_1\cup C_2$ is compact. So by the lemma it is contained in the interior of some compact set $K_2$. Continuing like this, at each step choose $K_{n+1}$ compact such that $K_n\cup C_{n+1}\subseteq\operatorname{int}(K_{n+1})$. The result is an increasing sequence of compact sets, each contained in the interior of the next one, and adding up to the whole space, that is, an exhaustion of $X$ by compact sets.