It's complicated. The exponential map is always surjective (but never injective) for $G$ a compact connected Lie group. Terence Tao gives a proof using Riemannian geometry here; for particular compact groups like $SO(n)$ or $U(n)$ this can be done by a direct computation using the spectral theorem.
Outside of the compact case, it's a classic exercise to show that the exponential map isn't surjective for $G = SL_2(\mathbb{R})$, and this has come up several times on math.SE before; see, for example, this question.
The question linked by The Chaz 2.0 in the comments contains a very nice but somewhat complicated characterization of injectivity. A necessary condition is that $G$ has trivial maximal compact subgroup (equivalently, no subgroup isomorphic to $S^1$) and that it be simply connected, and a sufficient condition is that $G$ is a simply connected nilpotent Lie group.
It's worth noting that in practice you really don't need either injectivity or surjectivity of the exponential map as much as you might think you do, and usually it suffices to use the weaker facts that
- the exponential map is a local diffeomorphism in a neighborhood of the identity, and
- a neighborhood of the identity generates a connected topological group, so a connected Lie group $G$ is generated by the image of the exponential map.
For example, these two facts imply that a homomorphism $G \to H$ of Lie groups, where $G$ is connected, is determined by its derivative $\mathfrak{g} \to \mathfrak{h}$.