In Segal’s Bourbaki talk on Elliptic cohomology, he mentions offhandedly that:
The set of pairs of commuting elements of a group $G$ are the set of homotopy classes of maps of a torus into $BG$.
Semon Rezchikov kindly explained this to me, and I found his explanation so simple and pleasing that I wish to share it.
Recall that $BG=K(G,1)$ and that $G = \pi_1(BG)$. A homotopy class of maps $S^1 \to BG$ is an element of $G$ (i.e. $BG$ is the delooping of $G$).
[If this statement confuses you, dear reader, Ctrl+F for “Eilenberg-Mac Lane space” in nCategories and Cohomology. If you are uncomfortable with a group as a category, Ctrl+F for “ordinary particle is a point” in From Loop Space Mechanics to Nonabelian Strings.]
Let $(a,b)$ be a pair of commuting elements in $G$.
In other words, let $(a,b)$ be a pair of paths in $\pi_1(BG)$ that commute. Note that $a$ and $b$ must be loops based at the same point to commute, and that the torus is $S^1 \times S^1$.
We map the first generator of the torus to $a$ and the second generator to $b$.
The first frame of this gif is then $ab$, and the last frame is $ba$ (the middle frames are homotopies).
Any paths in $\pi_1$ that commute (i.e. any pair $(a,b)$ of commuting elements in $G$) give a map of the torus into your space $BG$.