$H_1 \cap H_2$ is the affine group scheme $\alpha_p = \text{ker} \left( \mathbb{G}_a \xrightarrow{x \mapsto x^p} \mathbb{G}_a \right)$, with functor of points
$$\alpha_p(R) = \{ x \in R : x^p = 0 \}.$$
If $R$ has no nontrivial nilpotents, and in particular if $R = k$, then $\alpha_p(R) = 0$. However, $\alpha_p$ is not the zero group scheme, because for example it has nontrivial points over $k[x]/x^p$ (which is in fact the underlying affine scheme of $\alpha_p$). An affine algebraic group is determined by its $k$-points so this shows that $\alpha_p$ is not an affine algebraic group.
The assumption that $k$ is algebraically closed is only used to define what an affine algebraic group is.
I think this could be a legitimate mistake. Namely, Milne does seem to implicitly be saying that the map $G(k^\mathrm{sep})\to \pi_0(G_{k^\mathrm{sep}})$ is a surjection. But, this does not have to be the case.
Example: Let $k$ be a separably closed, but not perfect field of characterististic $2$ (e.g. $k=\mathbb{F}_2(\!(t)\!)^\mathrm{sep}$). As $k$ is not perfect, there exists some $\alpha \in k$ which is not a square. Consider the group functor
$$G\colon \mathbf{Alg}_k\to \mathbf{Grp},\qquad A\mapsto \{a\in A: a^4=\alpha a^2\},$$
which one can consider as a group under addition. This is obviously a finite type group $k$-scheme represented by $\mathrm{Spec}(k[x]/(x^4-\alpha x^2)$. Let us then observe that
$$G_{\overline{k}}\cong \mathrm{Spec}(\overline{k}[x]/(x^4-\alpha x^2)\cong \mathrm{Spec}(\overline{k}[x]/((x^2-\beta x)^2),$$
where $\beta$ is a square root of $\alpha$ in $\overline{k}$. In particular, as thickenings by nil-ideals are homeomorphisms (see Tag 0BR6) we see that
$$|G_{\overline{k}}|\cong |\mathrm{Spec}(\overline{k}[x]/(x^2-\beta x))|\cong |\mathrm{Spec}(\overline{k}[x]/(x-\beta))|\sqcup |\mathrm{Spec}(\overline{k}[x]/(x)|\cong |\mathrm{Spec}(\overline{k})|\sqcup |\mathrm{Spec}(\overline{k})|,$$
(where $|\cdot|$ denotes the underlying topological space). In particular, we see that $\pi_0(G_{\overline{k}})$ has two elements.
The upshot here is that as $\overline{k}/k$ is a totally inseparable extension, the map $G_{\overline{k}}\to G$ is a homeomorphism (see Tag 0BRD) and so the map $\pi_0(G_{\overline{k}})\to \pi_0(G)$ is a bijection. So, $\pi_0(G)$ has two elements. That said, $G(k)$ has one element as if $a^4=\alpha a^2$ where $a$ is non-zero, then by dividing by $a$ we'd deduce that $\alpha$ is a square, which is a contradiction. Thus, the map $G(k)\to \pi_0(G)$ cannot be a surjection. $\blacksquare$
This is not really an issue though. If $G$ is an algebraic group over any field $k$, one can still define a group $k$-scheme structure on $\Pi_0(G)$ (where I am using $\Pi_0$ opposed to $\pi_0$ just to emphasize the group scheme versus the group: so $\Pi_0(G)(k'):=\pi_0(G_{k'})$) such that $\Pi_0(G)$ is finite etale and the map $G\to \Pi_0(G)$ is a group homomorphism (and, in fact, the initial one to etale group schemes). This just follows essentially by applying the functor $\Pi_0$ to the maps
$$m\colon G\times_k G\to G,\quad i\colon G\to G, \quad e\colon \mathrm{Spec}(k)\to G$$
and using the fact that $\Pi_0$ commutes with fiber products over $k$. This is explained in Chapter II, §5, № 1 of Demazure--Gabriel's book Groupes Algebriques, Tome I.
Of course, if $k$ is perfect, then what Milne says is a shortcut to this.
Best Answer
Okay I think I found a counterexample that answers my question:
Assume that $k$ is of characteristic $0$. Consider the semidirect product $G = \mathbf{G}_a \rtimes \mathbf{Z}/2 \mathbf{Z}$ where $1 \in (\mathbf{Z}/2\mathbf{Z})(k)$ acts on $\mathbf{G}_a$ via $x \mapsto -x$. Also, let $a \in k \setminus \{ 0 \}$ and consider the algebraic subgroups $H_1 = \{ (0, 0), (0, 1) \}$ and $H_2 = \{ (0, 0), (a, 1) \}$ of $G$, both isomorphic to $\mathbf{Z}/2\mathbf{Z}$. Then the sheaf theoretic commutator of $H_1$ and $H_2$ is given by $\{ (2na, 0) \mid n \in \mathbf{Z} \} \cong \mathbf{Z}$ and thus is not an algebraic group. The commutator $[H_1, H_2]$ in the world of algebraic groups is given by $\{ (x, 0) \mid x \in \mathbf{G}_a \} \cong \mathbf{G}_a$.