More generally, let $R_i, i \in I$ be a finite collection of commutative rings and let $S$ be a commutative ring. Check that $\text{Hom}(\prod R_i, S)$ can naturally be identified with the data of
- a decomposition $S = \prod S_i$ of $S$ into a product over the same index set, and
- a tuple $f_i : R_i \to S_i$ of ring homomorphisms.
(There are several ways to think about this. A hint is to examine the images of the primitive idempotents $e_i = (0, \dots 1, \dots 0)$, where the $1$ occurs in the $i^{th}$ place.)
When each $r_i = \mathbb{Z}$ the ring homomorphisms $f_i$ are unique so the data is the data of a decomposition of $S$ into a product over $I$. Geometrically this is the same thing as a decomposition of $\text{Spec } S$ into $I$ disjoint components, which is in turn the same thing as a continuous (equivalently, locally constant) function $\text{Spec } S \to I$.
The case $|I| = 2$ is particularly easy to think about because we only need to track one nontrivial idempotent. $\mathbb{Z} \times \mathbb{Z} \cong \mathbb{Z}[e]/(e^2 - e)$ is the free commutative ring on an idempotent, so
$$\text{Hom}(\mathbb{Z} \times \mathbb{Z}, S) \cong \{ e \in S : e^2 = e \}$$
is precisely the set of idempotents in $S$, which you can check is in natural bijection with the set of ways to decompose $\text{Spec } S$ into two disjoint components.
Geometrically, the general claim is that a morphism $\text{Spec } S \to \bigsqcup \text{Spec } R_i$ disconnects $\text{Spec } S$ into $I$ components, the pullbacks of the morphism along the inclusions of each $\text{Spec } R_i$; more formally, the slice category over $\bigsqcup \text{Spec } R_i$ is naturally isomorphic to the product of the slice categories over each $\text{Spec } R_i$, which is one of the axioms defining an extensive category. This means intuitively that coproducts behave "disjointly," the way coproducts of sets or spaces do (but not the way coproducts of, say, groups do).
It's very false that $\text{Hom}(\mathbb{Z}^I, S) = S^I$ (although it's true that $\mathbb{Z}^I \otimes S \cong S^I$). The LHS is a set and the RHS is a ring, and the LHS is covariant in $I$ while the RHS is contravariant.
Another way to think about this result is to first check that $\text{Mod}(\prod R_i) \cong \prod \text{Mod}(R_i)$; that is, the category of modules over a finite product breaks up into a finite product of module categories, and the equivalence is given very explicitly via the primitive idempotents above. This is even an equivalence of symmetric monoidal categories, and so induces an equivalence from the category of commutative $\prod R_i$-algebras to the product of categories of commutative $R_i$-algebras, and the equivalence is the identification above.
Edit: Here's a cute corollary. Consider morphisms $\text{Hom}(R^I, R^J)$ where $I, J$ are finite sets and $R$ is a ring with no nontrivial endomorphisms (e.g. $\mathbb{Z}$, any localization of $\mathbb{Z}$, any prime field, but also weirder examples like $\mathbb{R}$). We get that such maps correspond exactly to morphisms $J \to I$ of finite sets, hence:
Claim: Let $R$ be a ring with no nontrivial endomorphisms. Then $\text{FinSet} \ni I \mapsto \text{Spec } R^I \in \text{Aff}$ is a fully faithful embedding.
I am going to give an identification of $DD(M)(S)$ and $M_S(S)$.
Using the identification $D(M)=\mathrm{Spec}\mathcal{O_S}[M]$ and $\mathbb{G}_m=D(\mathbb{Z})$, we have
$$DD(M)(S)=\mathrm{Hom}_{\mathcal{O}_S-\mathrm{Hopf-alg}}(\bigoplus_{i\in \mathbb{Z}}e_i\mathcal{O}_S,\bigoplus_{i\in M}e_i\mathcal{O}_S)$$
i.e. every element is determined by a map $\phi$ of $\mathcal{O}_S$-modules s.t. the following commutative diagram holds
$$\require{AMScd}\begin{CD}
\bigoplus_{i\in \mathbb{Z}}e_i\mathcal{O}_S @>\phi>> \bigoplus_{i\in M}e_i\mathcal{O}_S\\
@VV{e_i\mapsto e_i\otimes e_i}V @VV{e_i\mapsto e_i\otimes e_i}V\\
\bigoplus_{j,k\in \mathbb{Z}}e_{j}\mathcal{O}_S\otimes e_k\mathcal{O}_S @>\phi\otimes \phi>> \bigoplus_{a,b\in M}e_a\mathcal{O}_S\otimes e_b \mathcal{O}_S
\end{CD}$$
It's equivalent to the data $\mu :\mathcal O_S \cong e_1\mathcal{O}_S\stackrel{\phi}{\to}\bigoplus_{i\in M}e_i\mathcal{O}_S$ (written $\mu=\sum_i e_i \mu_i$ where $\mu_i:\mathcal{O}_S\stackrel{\mu}{\to}\bigoplus_{j\in M}e_j\mathcal{O}_S\to e_i\mathcal{O}_S\cong \mathcal{O}_S$) s.t. the diagram commutes
$$\require{AMScd}\begin{CD}
\mathcal{O}_S @>\mu>> \bigoplus_{i\in M}e_i\mathcal{O}_S\\
@VV{\mathrm{id}}V @VV{e_i\mapsto e_i\otimes e_i}V\\
\mathcal{O}_S @>{\mu\otimes\mu}>> \bigoplus_{a,b\in M}e_a\mathcal{O}_S\otimes e_b \mathcal{O}_S
\end{CD}$$
and $\sum_i \mu_i=\mathrm{id}$.
It's equivalent to the condition that $(\mathcal{O}_S\otimes \mathcal{O}_S\stackrel{\Delta}{\to}\mathcal{O}_S)\circ(\mu_a \otimes \mu_b)=\delta_{ab}\mu_a$ and $\sum_i \mu_i=\mathrm{id}$.
Over any affine open, we have $(\mathcal{O}_S\otimes \mathcal{O}_S\stackrel{\Delta}{\to}\mathcal{O}_S)\circ(\mu_a \otimes \mu_b)=\mu_a \circ \mu_b$. So it's equivalent to the condition that $\mu_a \circ \mu_b =\delta_{ab}\mu_a$ and $\sum_i \mu_i =\mathrm{id}$.
Claim: It's equivalent to the data {$(U_i)_{i\in M}$ is a disjoint open cover of $S$}.
Proof of the claim. Given a disjoint open cover $(U_i)_{i\in M}$ of $S$, then each $U_i^c=\bigcup_{j\neq i}U_j$ is open, there exist an unique element $c_i\in \mathcal{O}_S(S)$ s.t. $c_i|_{U_i}=1$ and $c_i|_{U_i^c}=0$ using axioms of sheaf. With each $c_i$ we can associate $\mu_i:\mathcal{O}_S\to \mathcal{O}_S,u\mapsto c_i u$. It's not hard to see that $\mu_a \circ \mu_b=\delta_{ab}\mu_a$. As $\sum_i c_i=1$, we have $\sum_i \mu_i=\mathrm{id}$.
Reversely for each $s\in S$, $\mu_{i,s}:\mathcal{O}_{S,s}\to\mathcal{O}_{S,s}$ is completed determined by $c_{i,s}=\mu_{i,s}(1)$. We know that $c_{i,s}c_{j,s}=\delta_{ij}c_{i,s}$ and $\sum_{i}c_{i,s}=1$. So each $c_{i,s}$ is idempotent ($x^2=x$), but the only idempotent elements in a local ring is $0$ and $1$. So exactly one of $(c_{i,s})_{i\in M}$ is 1.
For any $i$, denote $U_{i}$ as the subset consisting of $s$ s.t. $\mu_{i,s}=\mathrm{id}$. Then $(U_{i})_{i\in M}$ is disjoint. If $s\in U_i$, then $\mu_{i,s}=\mathrm{id}$, clearly it extends to an open neighborhood of $s$, see tag 01CP. Thus $(U_{i})_{i\in M}$ is disjoint open cover of $S$. The result follows.$\square$
Clearly the data {$(U_i)_{i\in M}$ is a disjoint open cover of $S$} is equivalent to the data {locally constant function $S\to M$}. The result follows.
Best Answer
Morphisms of affine group schemes are the same thing as morphisms of their corresponding Hopf algebras (a morphism of Hopf algebras is a $k$-linear map such that it is both a morphism of algebras and of coalgebras), so the set $X(G)$ is the set $\{ \varphi \colon k[\mathbb{G}_m] \to k[\Lambda] \}$ of Hopf algebra morphisms.
The coalgebra structure on $k[\mathbb{G}_m] = k[x^{\pm 1}]$ is $\Delta(x) = x \otimes x$, and $\epsilon(x) = 1$: in other words, the element $x$ is group-like, and therefore must be sent to another group-like element by any homomorphism $\varphi$.
The coalgebra structure on $k[\Lambda] = \bigoplus_{g \in \Lambda} kg$ is $\Delta(g) = g \otimes g$ and $\epsilon(g) = 1$ for each basis element $g \in \Lambda$. So clearly the basis elements are group-like, and setting $\varphi(x) = g$ for any $g \in \Lambda$ will yield a bialgebra homomorphism. The question is: are there any other group-like elements in $k[\Lambda]$?
The answer is no: the basis of original group elements are precisely the set of group-like elements in the Hopf algebra $k[\Lambda]$. (This is fairly easy to prove, and is where you can use the fact that $k$ is a domain).