What follows is an attempt to motivate this beautiful and difficult (in my opinion) subject. It is just an attempt, I cannot promise it will be useful.

Suppose you have a family of curves over $\mathbb A^1=\textrm{Spec }\mathbb C[t]$, like for instance the family $$\pi:\textrm{Spec }\mathbb C[x,y,t]/(xy-t)\to \mathbb A^1$$ given by $t\mapsto t$. As it is explained very well in Hartshorne's book, deformation theory is:

$\textbf{the infinitesimal study of a family in a neighborhood of one of its members.}$

For instance, the member corresponding to $t=0$ is very special in the above family, as it is the only singular fiber of $\pi$: the smooth hyperbolae *degenerate*, or rather, *deform* to a singular conic, the union of two lines at a point (draw a picture!). In a "neighborhood" of this member of the family, all other curves are smooth conics, so when we stare at this unique, very special singular conic, the natural question arises:
$$\textrm{How could that happen?}$$
The curiosity towards the answer to such a question could be one motivation for deformation theory.

Now you can already see the relation to moduli: we just finished talking about a "family of curves"...

Now let me tell you something very naive. Let $x$ be a (closed) point on a variety $X$. What does it mean to deform $x$ in $X$? Well, pretend *you* are a point on a sphere, then to "deform yourself" you have to look around you in all possible directions and see what surrounds you - but you need to do this infinitesimally, first because you are a point, and second because deformation theory is the *infinitesimal* study of geometric objects. So it turns out that to deform yourself means to choose a tangent direction on the sphere. More generally,
$$\{\textrm{Deformations of }x\textrm{ in } X\}=T_xX=\hom_{k(x)}(\textrm{Spec }k[t]/t^2,X).$$

Let $D=\textrm{Spec }k[t]/t^2$. In general you have this:

**Definition**. Let $i:Y\hookrightarrow X$ be a closed subscheme. A first order deformation of $Y$ in $X$ (also called a deformation of $i$) is flat morphism $f:\mathfrak X\to D$, where $\mathfrak X$ is a closed subscheme of $X\times D$, $Y$ is the fiber over the closed point of $D$, and $f$ is induced by the projection $X\times D\to D$.

I'll tell you later what nice group describes these objects!

**Example**. Suppose $X$ is a variety such that $H^1(X,\mathscr O_X)=0$. This cohomology group is the tangent space of any point $[L]\in \textrm{Pic }X$. So if it vanishes, it means that line bundles on $X$ do not deform.

**Example**. Let $\mathbb P^5_\mathbb C$ be moduli space of plane conics. Let's pick an explicit conic $C\subset\mathbb P^2_\mathbb C$, and let us try to compute its tangent space as a *point* $p=[C]$ in the moduli space $\mathbb P^5$. So we find:
\begin{align}
T_{[C]}\mathbb P^5&=\hom_{\mathbb C(p)}(\textrm{Spec }k[t]/t^2,\mathbb P^5) \notag\\
&=\hom_\mathbb C(m_p/m_p^2,\mathbb C)\notag\\
&=H^0(C,N_{C/\mathbb P^2}).
\end{align}
Is it really $5$-dimensional? Since
$$N_{C/\mathbb P^2}=\mathscr O_{\mathbb P^2}(C)|_C=\mathscr O_C(2)=\mathscr O_{\mathbb P^1}(4),$$ yes, it is $5$-dimensional, as expected.

More than finding the expected dimension for the tangent space, it is interesting to observe that, once you define what a first order deformation of $C$ in $\mathbb P^2$ is (as I did above), it turns out that such objects are parameterized by the cohomology group $H^0(C,N_{C/\mathbb P^2})$. So the upshot is: the deformations of the closed embedding $C\subset \mathbb P^2$ are *exactly* the deformations of $[C]$ as a moduli point in $\mathbb P^5$. There we found another strong link with moduli!

More generally: The first order deformations of a closed subscheme $i:Y\hookrightarrow X$ are parameterized by $H^0(Y,N_{Y/X})$, which is also the tangent space of $[Y]$ as a point in the Hilbert scheme of $X$.

I just realized that my answer is much longer than I thought it was in my mind, so let me finish justifying the ubiquity of local Artinian $k$-algebras: their category is equivalent (under the functor $\textrm{Spec}$) to the category of *fat points over* $k$.
Why on earth should we care about fat points? (A fat point over $k$ is just a $k$-scheme $F$ such that the structural morphism $F_{\textrm{red}}\to \textrm{Spec }k$ is an isomorphism: they are $0$-dimensional schemes having one closed point with some ugly but useful non-reduced structure). Now, $D=\textrm{Spec }k[t]/t^2$ is one such, but it is very special, because it describes the unique scheme structure one can put on a double point. First order deformations are those parameterized by this $D$, and they are flat morphisms (say) over $D$ such that over the closed point there lies the object you want to deform. Considering families over a fatter point, e.g. over $\textrm{Spec }k[t]/t^3$ is the study of *higher order* deformations. These are very different from the first order one, e.g. you may not have any deformation at all over a certain algebra $A$, whereas over $D$ you always have the trivial deformation (the one corresponding to the element of the cohomology group which is concerned). If you have one, you may want to know if you can extend it further, and this leads to study small extensions of local Artin $k$-algebras.

Good references are online notes by Ravi Vakil, and Sernesi's book *Deformations of algebraic schemes*.