TITLE: Subgroups of hyperbolic groups
QUESTION [5 upvotes]: Let $G$ be a finitely generated hyperbolic group, and let $H \leq G$ be a subgroup whose profinite completion is finitely generated. Must $H$ be finitely generated?

In view of Ian Agol's answer, I am ready to assume that $G$ is
  residually finite.

REPLY [5 votes]: Let $A$ be a finitely generated group, and let $\beta \colon A \to A$ be an injective homomorphism which is not surjective. Freely construct a group $G$ generated by $A$ and some formal element $t$ such that the equality $tat^{-1} = \beta(a)$ holds in $G$ for each $a \in A$. $G$ is called the strict ascending HNN extension of $(A, \beta)$. Set $$H := \bigcup_{n=0}^{\infty} t^{-n}At^n$$ where the union is taken in $G$. $H$ is a strictly ascending union of finitely generated subgroups of $G$ which are all isomorphic to $A$. It follows that $H$ is a subgroup of $G$ which is not finitely generated (if it were, the union could not be strictly ascending). On the other hand, every finite image of $H$ is clearly a finite image of one of the groups in the union (which is isomorphic to $A$) and can thus be generated by $d(A)$ elements. It follows that the profinite completion of $H$ is finitely generated.
To answer my question it suffices to choose $A$ and $\alpha$ in a way that will make $G$ hyperbolic. Take $A$ to be the free group on $x,y$ and define $\beta$ by $\beta(x) = xy$ and $\beta(y) = yx$. It is easy to see that $\beta$ is injective but not surjective. In this case, $G$ is the Sapir group, and its hyperbolicity is established in Theorem 4.1 of http://arxiv.org/pdf/1302.5370.pdf
If we want an answer to the extended question, i.e. with $G$ residually finite, then we can take $A$ to be the free group on $x,y$ and define $\beta$ by $\beta(x) = xy^{-1}x^2y$ and $\beta(y) = yx^{-1}y^2x$. Again, it is easy to see that $\beta$ is injective but not surjective. By Theorem 4.2 of http://arxiv.org/pdf/1302.5370.pdf the resulting $G$ is hyperbolic and linear over $\mathbb{Z}$, and thus, residually finite.