Some of the answers provided above are pretty good. Let me try to provide an answer from a slightly different formulation for completeness. The approach I am going to take is to start from the general non-equilibrium description of the gas in question, and motivate what being in "equilibrium" means. The full non-equilibrium dynamics is governed by the Boltzmann equation.
Physical Kinetics, the 10th book in the Landau-Lifshitz series is an excellent reference.
We start with a gas composed of particles obeying the dispersion relation $\epsilon = \frac{p^2}{2m}$ (the gas is isotropic) . In general, when the gas is not in equilibrium, it's physical state is described by the "Boltzmann distribution function" $f(x,p,t)$. Note that $\int{d^dp f(x,p,t)} = n(x,t)$, the number density at (x,t), d = number of spatial dimensions. We can see that this allows us to describe non-equilibrium situations through its dependence on $x$ and $t$.
The distribution function described above is governed by the Boltzmann equation. Let me first write it down, and then I'll describe what it means:
$\scriptsize{ [\partial_{t} + v.\nabla_{x} + F.\nabla_{p}]f(x,p,t) = \\ \iiint d^dp_1 d^dp_2 d^dp_3 \delta^d(p+p_1 -p_2 - p_3) \delta(\epsilon(p) +\epsilon(p_1) - \epsilon(p_2) -\epsilon(p_3)) w(p,p_1 \to p_2,p_3) [f(p_2,x,t)f(p_3,x,t) - f(p,x,t)f(p_1,x,t)] }$.
First, the LHS. $v= \nabla_p (\epsilon)$ is the "velocity" of a particle with momentum $p$, whereas $F$ is the force experienced by it. The LHS is the net change in the number of particles in a given phase space volume due explicit variation on time (first term) , or, phase space flows out of the phase space volume (next two terms). The last two terms are usually called the "streaming terms".
Now, the "collison term": The RHS is the rate at which collisions contribute to changing $f$. There must be some collisions that result in a final state that lies in the given phase space volume. These contribute positively (+) to the collision term. In the reverse direction, there are collisions that involve a particle in the given phase space volume. These contribute negatively (-). We can motivate that the rate of any type of collision $q_A + q_B \to q_C + q_D$ must depend on the number of particles available to participate in this collision, ie, $f(q_A) f(q_B)$. These observations explain the term inside the square bracket.
A few more comments are in order. First, the delta functions. These come from the assumption that the dynamics of the gas is symmetric under space-time translations. This implies that total energy and total momentum are conserved quantities, which can only be possible if we only allow, at the microscopic level, collisions that conserve energy and momentum. This explains the deltas.
Finally, the collision rate $w$. A natural question to ask is: why do we not have different collision rates for the forward and backward reactions? ie, why is $w(p,p_1 \to p_2,p_3) = w(p_2,p_3 \to p,p_1)$? The answer is that at the microscopic level, we assume that the dynamics is invariant under time reversal, hence, in particular, forward and backward reactions rates must be same. This is called the "principle of detailed balancing".
So, bringing the streaming terms on the RHS, we can see what the Boltzmann equation tells us; that the change in number of particles in a given phase space volume is totally accounted for by the rate at which particles are "streaming" in (or out), and the rate at which the particles are being "collided" into or out of, the given phase space volume.
Now, we are in a position to motivate what we mean by "equilibrium". Equilibrium is the situation when each of the above terms is explicitly zero. For the first term, this implies $\partial_t f=0$. For the streaming terms, this implies $\nabla_x f= 0$ and $F=0$. For the collision term, we see that this implies that $[f(p_2)f(p_3) - f(p)f(p_1)] = 0$. The $x,t$ dependence can be dropped, as now we are describing a gas in equilibrium.
We must remember the constraints imposed on the momenta due to the delta functions in the collision term. In general, if I want to impose the above condition, given the constraint $g(p)+g(p_1) = g(p_2)+g(p_3)$, for some function $g$, then one solution to the above equation (it can easily be checked) is $f(p) = e^{-\gamma g(p)}$, where $\gamma$ is some constant. Here, we have two things to conserve, energy and momentum, hence, the general equilibrium distribution is described by $f_{eq}(p) = e^{-\beta (\epsilon(p) - p.V)}$, where $\beta$ and $V$ are constants. Note that the case of non zero $V$ signifies a gas in uniform motion (a gas in uniform motion is also in "thermodynamic equilibrium") with velocity $V$. We will assume that we are in the rest frame of the gas at equilibrium, ie, $V=0$. Hence, we obtain $f_{eq} = e^{-\beta \epsilon(p)}$. We identify $T = \frac{1}{\beta}$ as the "Temperature" (Boltzmann constant $k_B$ has been set to 1)
To compute the equilibrium speed distribution, we must integrate over a shell of momentum magnitude $|p|$. The (d-1) dimensional area of said shell ~ $ |p|^{d-1}$. Identifying $|p|$ as $m v$, where $m$ is the mass of a single particle, we finally obtain
$f_{Maxwell}(v)$ ~ $v^2 e^{-\beta \frac{p^2}{2m}}$ ~ $v^2 e^{- \frac{mv^2}{2T}}$, which is what we set out to show.