Having a centerless profinite completion leads to some nice properties. For example, given a short exact sequence
$$1\to A\to B\to C\to 1$$
where $A$ is finitely generated and $\hat{A}$ has trivial center, we have an exact sequence
$$1\to\hat{A}\to\hat{B}\to\hat{C}\to 1.$$
When does a centerless group $G$ have a centerless profinite completion $\hat{G}$? Does this change if $G$ is finitely generated and/or residually finite?
I know that if $G$ is residually finite, then we have an injection $G\to \hat{G}$ with dense image, and so $Z(\hat{G})$ would have to live solely within $(\hat{G}\setminus G)\cup\{e\}$. This seems unlikely, but I don't see the proof.
Here's a finitely generated group with trivial center whose profinite completion is isomorphic to the profinite completion of $\mathbf{Z}$ (hence with nontrivial center).
Namely, the subgroup of the group $\mathfrak{S}(\mathbf{Z})$ generated by the alternating group $A$ (even finitely supported permutations) and the shift $s:n\mapsto n+1$. It is actually generated by $s$ and by the 3-cycle $(012)$. This is a semidirect product $A\rtimes\langle s\rangle$. It has trivial center since the centralizer of the alternating subgroup in the whole symmetric group is trivial. Since $A$ is infinite simple, its image in the profinite completion is trivial, whence the claim.
I'm not sure now about a residually finite example.
Here's a residually finite example (not finitely generated). Consider the Baumslag-Solitar group $\mathbf{Z}_{(p)}\rtimes_{p+1}\mathbf{Z}$, where (to simplify) $p$ is prime and the action is by multiplication by $p+1$. It is easy to see that the profinite completion is $$\mathbf{Z}_p\rtimes_{p+1}\hat{\mathbf{Z}};$$ the action is not faithful because it factors through $\mathbf{Z}_p\subset \hat{\mathbf{Z}}$. So all the kernel of the action is central.