Here is an argument for the semi-simple case: First, suppose that the center of $G$ is trivial. Then $G$ (via adjoint representation) can be considered as a subgroup of $GL(n)$. Consider a neighborhood $U$ of $0$ in the Lie algebra on which the exponential map is a diffeomorphism. If there is any $g \in \exp(U)$ with an eigenvalue which is off the unit circle in $\mathbb C$ then $\langle g \rangle$ is discrete. Otherwise the eigenvalue of every $X \in U$ will be in $\sqrt{-1} \mathbb{R}$, which then would be the case for all $X \in Lie(G)$. Now, it is easy to see that this can only happen for non-compact semi-simple groups, for instance because the Lie algebra must have a copy of $sl_2$. (Jacobson-Morozov).
Now, the argument would work in general semi-simple case because, as long as $G/Z(G)$ is not compact, a pre-image of the generator of a non-discrete cyclic subgroup, generates such a subgroup and the universal cover of a semi-simple compact Lie group is also compact.