Functoriality of associating to a group algebra $kG$ its center $Z(kG)$, where $G$ is finite It's well known that associating a group $G$ to its center $Z(G)$ is not functorial (read: doesn't extend to give us a functor $\mathsf{Grp} \to \mathsf{Ab}$). A simple counterexample is given by considering the inclusion of $C_2 \hookrightarrow S_3$, which has a retract given by $S_3 \to S_3^{\text{ab}} = S_3/A_3 \cong C_2$. You arrive at a contradiction for the functoriality of $Z(-)$ because $Z(S_3)$ is trivial. You can find more on this here https://math.stackexchange.com/a/3380460/395669.
Along these lines, one can construct a counterexample to show the failure of functoriality of $Z(-)$ for $k$-algebras (read: doesn't extend to give us a functor ${}_k\mathsf{Alg} \to {}_k\mathsf{CommAlg}$), where $k$ is a unitcal commutative ring, by considering the algebras $k[F_1]$ and $k[F_2]$. Here, $F_1$ is the free group with one generator $x$ seen as a subgroup of $F_2$, the free group with two generators $x$ and $y$. Then, as above, the inclusion $k[F_1] \hookrightarrow k[F_2]$ has a retract given by $k[F_2] \to k[F_2]/(y-x) \cong k[F_1]$. You arrive at a contradiction for the functoriality of $Z(-)$ because $Z(k[F_2])$ is trivial, while $k[F_1]$ is a commutative $k$-algebra and hence its center is itself.
All this fine, what I've been unable to do is come up with a counterexample that shows the failure of $Z(-)$ to be a functor in the case of group algebras, when the group is finite. Here, the center of a group algebra has a different flavour, since it's a free $k$-module. Any ideas?
Addendum: A recent reading gave me a very partial answer to this question, which may or may not have a connection with Hochschild Cohomology. For a $k$-algebra $A$, we can talk about its commutator space $[A,A]$ defined as the $k$-submodule generated by $[a,b] = ab - ba$. Then for obvious reasons given an algebra map $A \to B$, we get an induced map $A/[A,A] \to B/[B,B]$. So we have a functorial construction here.
Now, in the case of a group algebra $kG$ for a finite group $G$, we define the $k$-dual of $Z(kG)$ obviously as $Z(kG)^* = \mathrm{Hom}_k(Z(kG),k)$. Then, we have a $k$-module isomorphism $kG/[kG,kG] \cong Z(kG)^*$. And so, given an algebra map $kG \to kH$, we do get a map $Z(kH) \to Z(kG)$, which is $k$-linear but not necessarily multiplicative. So, the center gives a contravariant functor but not quite straightforward.
 A: Let's suppose that $kG$ is semisimple (for instance when $k$ is algebraically closed and of characteristic $0$), since that lets us identify $Z(kG)$ with the subalgebra of central idempotents, a free subalgebra whose generators are in one-to-one correspondence with isomorphism classes of irreducible representations of $G$.
I'm only going to partially answer the question, unfortunately.  I'm going to define a functor from $k$-algebras to $k$-modules that sends $kG$ to $Z(kG)$.  When the algebra homomorphism $f:kG\to kH$ is induced by a surjective group homomorphism, then the induced map $f_*$ will be the algebra homomorphism $f|_{Z(kG)}$.  If the homomorphism is not surjective, then it appears $f_*$ is not an algebra homomorphism in general, and if $f$ is an arbitrary algebra homomorphism, I don't expect $f_*$ to be an algebra homomorphism.
Maybe something in here will shed light on your problem.  (But partly I'm answering because I want to write out this cyclic tensor product calculation somewhere.)

There are two ways to get the center of $kG$.  The first is the definition:
$$Z(kG) = \{a \in kG\mid \text{for all }b\in kG,ab=ba\}$$
The second is the horizontal trace, which unlike $Z(kG)$ is not obviously an algebra: consider $kG$ as a $kG$-bimodule, and let $(kG)_0$ denote in this answer $kG$ modulo the relation $am\sim ma$ for $a\in kG$ and $m\in kG$.  In other words, this is $kG$ modulo cyclic shifts of words, and it's not hard to see that it's a vector space whose dimension is the number of conjugacy classes of $G$. (Note: this is not the abelianization of the algebra!)  A priori, this is merely a $k$-algebra, but surprisingly it has a multiplication operation.
Before getting into that, let's talk about the idea behind the construction.  An important part of the theory of representations of finite groups is that $Z(kG)$ is a free algebra whose generators are orthogonal idemponents $\pi_1,\dots,\pi_n$, one corresponding to each isomorphism class of irreducible representation $V_1,\dots,V_n$ of $G$.  Let $V=V_1\oplus \cdots\oplus V_n$ be thought of as a left $kG$-module.  It is also a right $Z(kG)$-module (and hence a $(kG,Z(kG))$-bimodule) by using this left action, which works out because elements of $Z(kG)$ commute with those of $kG$.  Let $V^{*}$ be the dual representation $V$ but as a $(Z(kG),kG)$-bimodule (when you swap it like this, you don't need to insert inverses in the action).  We can form two tensor products $V\otimes_{Z(kG)} V^*$ and $V^*\otimes_{kG}V$.  Let's determine what they are isomorphic to before proceeding.
For the first tensor product:
$$ V \otimes_{Z(kG)} V^* = \bigoplus_{ij} V_i \otimes_{Z(kG)} V_j^* = \bigoplus_i V_i\otimes_k V_i^* = \bigoplus_i \operatorname{End}_k(V_i) \cong kG$$
where the first equality is from expanding direct sums, the second is from observing that when $i\neq j$ then there is a projector that kills the term and the remaining projector $\pi_i$ just acts by the identity on $V_i$, the third is since each $V_i$ is finite-dimensional, and the final isomorphism is the Artin-Wedderburn theorem.
For the second tensor product:
$$ V^* \otimes_{kG} V = \bigoplus_{ij} V^*_i \otimes_{kG} V_j = \bigoplus_i V^*_i \otimes_{kG} V_i \cong \bigoplus_i \operatorname{End}_{kG}(V_i) = \operatorname{End}_{kG}(V) \cong Z(kG) $$
The first two equalities are similar (and this time the second equality is from the fact that $\pi_1,\dots,\pi_n\in kG$).  For the next step, we have isomorphisms $V^*_i\otimes_{kG} V_i \cong k \cong \operatorname{End}_{kG}(V_i)$ by the fact that $V_i$ is a cyclic module and Schur's lemma.  Then, the direct sum commutes with $\operatorname{End}_{kG}$ since each irreducible representation appears exactly once, and the final isomorphism is that $Z(kG)$ is identified with the free algebra described earlier.
The idea with the horizontal trace $(kG)_0$ is that we form the tensor product of $V$ and $V^*$ cyclically to get a $k$-module.  There isn't very good notation for it, so let's settle with
$$V\otimes_{Z(kG)} V^* \otimes_{kG}{}$$
where that trailing tensor product means it's between $V^*$ as a right module and $V$ as a left module.  The interesting this is that on one hand we have
$$V\otimes_{Z(kG)} V^* \otimes_{kG}{} \cong kG\otimes_{kG}{} = (kG)_0$$
and on the other we have
$$V\otimes_{Z(kG)} V^* \otimes_{kG}{} = V^* \otimes_{kG}V\otimes_{Z(kG)}{} \cong Z(kG)\otimes_{Z(kG)}{} = Z(kG)$$
Thus, we've identified $(kG)_0$ with $Z(kG)$, and with this we can give $(kG)_0$ an algebra structure!
On $(kG)_0$, this should define the multiplication operation:
$$[g][g'] = \frac{1}{\lvert G\rvert}\sum_{h\in G} [ghg'h^{-1}]$$
where $[g]\in (kG)_0$ denotes the image of $g\in G$.  (The scaling factor is chosen such that the composition $Z(G)\hookrightarrow kG \twoheadrightarrow (kG)_0$ is an algebra homomorphism.)  In other words, by representing elements of $(kG)_0$ as linear combinations of conjugacy classes, to form the product of two conjugacy classes we take a representative of the first class, multiply it by each element of the second, and take the conjugacy class of each product.
Now that we've understood $(kG)_0$ better, let's talk about functoriality.  Consider an algebra homomorphism $f:kG\to kH$.  There is an induced map
$$f_*:(kG)_0 \to (kH)_0$$
defined by $[m]\mapsto [f(m)]$, which is well-defined since $f(am-ma)=f(a)f(m)-f(m)f(a)$ for $a\in kG$ and $m\in kG$.
If $f$ is induced by a surjective group homomorphism $\phi:G\to H$, then we can calculate
\begin{align*}
f_*([g][g']) &= \frac{1}{\lvert G\rvert} \sum_{h\in G} [f(g)f(h)f(g')f(h)^{-1}] \\
&= \frac{\lvert \ker \phi\rvert}{\lvert G\rvert} \sum_{h\in H} [f(g)hf(g')h^{-1}] \\
&= \frac{1}{\lvert H\rvert} \sum_{h\in H} [f(g)hf(g')h^{-1}] \\
&= [f(g)][f(g')].
\end{align*}
Thus $f$ induces an algebra homomorphism $Z(kG)\to Z(kH)$ functorially.
If $\phi$ is an arbitrary group homomorphism, then instead
\begin{align*}
f_*([g][g']) &= \frac{1}{\lvert G\rvert} \sum_{h\in G} [f(g)f(h)f(g')f(h)^{-1}] \\
&= \frac{1}{\lvert \operatorname{im} \phi\rvert} \sum_{h\in \operatorname{im}\phi} [f(g)hf(g')h^{-1}]
\end{align*}
and, with $h_1,\dots,h_k\in H$ being coset representatives for $\operatorname{im}\phi$, with $h_1=1$ and with $k=\lvert H\rvert / \lvert \operatorname{im}\phi\rvert$),
\begin{align*}
[f(g)][f(g')]
&= \frac{1}{\lvert H\rvert} \sum_{h\in H} [f(g)hf(g')h^{-1}] \\
&= \frac{1}{\lvert H\rvert} \sum_{i=1}^k\sum_{h\in \operatorname{im}\phi} [f(g)h_ihf(g')h^{-1}h_i^{-1}] \\
&= \frac{1}{k\lvert G\rvert} \sum_{i=1}^k \sum_{h\in G} [f(g) h_i f(hg'h^{-1}) h_i^{-1}] \\
&= \frac{1}{k}\left( f_*([g][g']) + \frac{1}{\lvert G\rvert} \sum_{i=2}^k \sum_{h\in G} [f(g) h_i f(hg'h^{-1}) h_i^{-1}]\right).
\end{align*}
So we can see that it's not quite an algebra homomorphism.  There's probably something more that could be said, but I'm not seeing it right now.

If I understand things correctly, the horizontal trace is related to the Hochschild homology of $kG$ with $kG$ coefficients.  The only nontrivial homology group is $HH_0(kG,kG)$, I believe, and it is isomorphic to $(kG)_0$ (hence why I wrote the subscript-$0$).  Hochschild homology is functorial, explaining, in some sense, why $(kG)_0$ is.
One thing I'm confused about is why I got Hochschild homology rather than cohomology.  The complex $HH^\bullet(kG,kG)$ is, I believe, known as the derived center of an algebra.  The correspondence between homology and cohomology here might be a coincidence for group algebras (or semisimple Hopf algebras?)
