The answer to the title question is No, that is
A locally compact group has a compact open subgroup or a discrete infinite cyclic subgroup.
[Keivan Karai helped me a lot, without being responsible for the possible mistakes in this post.]
Step 1. The case of a connected noncompact Lie group.
We claim that a connected noncompact Lie group $G$ has a discrete infinite cyclic subgroup.
Arguing by contradiction, assume $G$ is a counterexample of smallest dimension, and let $Z$ be its center.
Suppose $Ad(G)$ is compact. Then $Z$ is noncompact. If $\dim Z=0$, then $G$ is a noncompact connected covering of the connected compact group $Ad(G)$, which is impossible. Thus, $\dim Z\ge1$. Let $Z_1$ be the connected component of $Z$. If $Z_1$ were compact, $G/Z_1$ would be a counterexample of smaller dimension. If $Z_1$ were noncompact, it would contain a discrete infinite cyclic subgroup, again a contradiction.
Thus, $Ad(G)$ is noncompact. Replacing $G$ with $Ad(G)$, we can suppose $G\subset GL_n(\mathbb R)$.
Say that an endomorphism $x$ of a real finite dimension vector space $V$ satisfies condition (C) if it is semisimple with imaginary eigenvalues, or, equivalently, if the subgroup $exp(\mathbb Z x)$ of $GL(V)$ is not an infinite discrete subgroup.
Let $\mathfrak g$ be the Lie algebra of $G$, and $x$ be in $\mathfrak g$. If $x$ is nonzero and satisfies (C), the same holds for $ad(x)$, implying $Killing(x,x) < 0$. If it were so for all nonzero $x$ in $\mathfrak g$, then $\mathfrak g$, and thus $G$, would be compact.
Step 2. The general case.
Let $G$ be our locally compact group, $C$ its connected component, and recall the following facts (see [1], [2], and references therein):
(1) If $G$ is totally disconnected, then $G$ contains a compact open subgroup.
(2) $C$ is a normal subgroup of $G$, and $G/C$ is totally disconnected.
(3) If $G$ is connected, then every neighborhood of 1 contains a compact normal subgroup $K$ such that $G/K$ is a connected Lie group.
Assume $G$ has no compact open subgroups.
We must show that $G$ has a discrete infinite cyclic subgroup.
As $C$ is noncompact by (1) and (2), we can assume $G=C$, that is $G$ is connected. Then (3) implies that $G$ contains a compact normal subgroup $K$ such that $G/K$ is a connected noncompact Lie group, and we can assume $K=1$, that is $G$ is a connected noncompact Lie group, and the conclusion follows from Step 1.
[1] Willis, G. The structure of totally disconnected, locally compact groups. Math. Ann. 300 (1994), no. 2, 341-363.
http://gdz.sub.uni-goettingen.de/en/dms/load/img/?IDDOC=167209
[2] Willis, G. Totally disconnected, nilpotent, locally compact groups. Bull. Austral. Math. Soc. 55 (1997), no. 1, 143-146.
http://journals.cambridge.org/action/displayFulltext?type=1&fid=4856560&jid=BAZ&volumeId=55&issueId=01&aid=4856552
This question just got bumped to the front page by the Mathoverflow bot. But the question was already answered in the comments by BCnrd. Following advice from this Meta article, I'm going to copy BCnrd's answer here so the OP can accept this answer and this question won't get bumped up again. My response is CW so I can't gain any reputation.
The answer to the question is "no." Here's why:
First, note that every totally disconnected topological group is Hausdorff. Next any locally compact subspace of a Hausdorff space is locally closed, hence open in its closure (see e.g. Munkres Topology for a proof of this). If $P$ was a totally disconnected topological group and $G$ is a locally compact subgroup then $G$ is open in its closure $\overline{G} \subset P$, which in turn is a closed subgroup of P. But open subgroups of topological groups are closed, so $G$ is closed in $\overline{G}$ and hence $G=\overline{G}$. This proves (2) is impossible.
Best Answer
No. Here's a counterexample.
Every 3-adic integer $x\in\mathbb Z_3$ has a unique representation as $x=\sum_{n\geq 0} a_n 3^n$ with balanced ternary digits $a_n\in\{-1,0,1\}.$ Define $f(x)=\sum_{n\geq 0} |a_n|/(n+1)\in[0,\infty].$ Define $d(x,y)=f(x-y).$ It's fairly easy to show this satisfies the triangle inequality; it suffices to consider finite integers, and each carry $3^n+3^n=3^{n+1}-3^n$ reduces the contribution to $f,$ from $1/(n+1) + 1/(n+1)$ to at most $1/(n+2) + 1/(n+1).$
Take $G$ to be the abstract subgroup of $x\in\mathbb Z_3$ such that $f(x)<\infty,$ equipped with the metric $d.$ This is an abelian Polish group. Fix $x\in G\setminus\{0\}.$ To show that subgroups containing $x$ are not locally compact, let's take an arbitrary $\epsilon>0$ and try to show that there is an infinite sequence of integers $p_i$ with $f(p_ix)<\epsilon$ but $f((p_i-p_j)x)>\epsilon/2$ for all $i<j.$
Lemma. For any $N$ we can pick $p\in\mathbb N$ such that $f(px)\in (\epsilon/2,\epsilon)$ and $p\equiv 0\pmod {3^N}.$
Proof. First write $x=3^ky$ where $y\not\equiv 0\pmod 3.$ Since $\sum 1/n$ diverges, a sufficiently good finite $3$-adic approximation $p'$ to $(3^N+3^{N+1}+3^{N+2}+\dots)/y$ will give $f(p'x)>\epsilon/2.$ Let $m$ be the greatest integer such that $f(3^mp'x)>\epsilon/2.$ Then $f(3^mp'x)<\epsilon,$ because multiplying by $3$ reduces $f$ by at most a factor of $2.$ So $p=3^mp'$ will do. $\square$
We can therefore pick sequences of integers $p_0,p_1,\dots$ and $N_0,N_1,\dots$ satisfying:
The last two conditions ensure $f((p_i-p_j)x)>\epsilon/2$ for $i<j.$