Let $G$ be a group and $A\subseteq G$. Consider $H=\{g\in G: gag^{-1}\in A \text{ for all } a\in A\}$. I want to show that that $H$ does not have to be a subgroup of $G$. (Note that for a finite $G$ it always is a subgroup because it suffices to prove closure, which is true in this case).
The material I am using gives the following counterexample, I see why it is a counterexample but I would like to understand intuitively how you can arrive at this result.
Let $G$ be the set of all permutations over $\mathbb{Z}$ and define $S_f=\{n\in\mathbb{Z}:f(n)\neq n\}$ for $f\in G$. Set $A=\{f\in G: S_f\subseteq \mathbb{N}_{>0}\}$. Consider $g\in G$ with $g(n)=n+1$ for all $n$. It's easy to check that $g\in H$. To arrive at a counterexample, we now show that $g^{-1}\notin H$. Let $a\in G$ with $a(1)=2$, $a(2)=1$ and $a(n)=n$ for $n\neq 1,2$, so that $a\in A$. Then $g^{-1}ag(0)=g^{-1}a(1)=g^{-1}(2)=1$. This shows that $0\in S_{g^{-1}ag}$ and thus $g^{-1}ag\notin A$ so that $g^{-1}\notin H$.