A useful illustration for differential geometry

The reason for the problem, I think, can be found in this quote from the pgfplots manual:

If there is no value for neither mesh/rows nor mesh/cols or if one of them is 1, pgfplots will draw a line plot. [...]

For \addplot3 expression, this requires to set samples y=0 to disable the generation of a mesh.

(Emphasis mine.) Note that samples y=1 will also work, and the manual says this at another point:

If you use \addplot3 expression, mesh/rows and mesh/cols are computed from the values samples and samples y. By default, \addplot3 expression always samples a mesh. If you want it to sample a line, set samples y=1 (or, equivalently, y domain=0:0).

(Again, emphasis mine. I don't know the technical differences between the two.)

Seems line specifications didn't work for a mesh, and the mesh is also the reason you got closed curves. Hence, if you set samples y=0 for your black lines, it works as expected. I did that via a style, in the example below.

I actually made three different styles, one for the point, one for the coordinate lines, one for the shape, one for the point. You also had the wrong z-coordinate for the second coordinate line, it should be f(0.8,t) not f(t,-1.2).

For the annotations, you can use relative coordinates. Say you have a saved coordinate c, you can do something like

\draw [stealth-] (c) to[bend left] ++(2cm,1cm) node[right] {...};

This puts the arrow tip at the start of the path, and the node at the end is placed at right of the end of the path. This saves you absolute coordinates, and also having to reuse those in the \node.

I also modified some of the math, notably use \dim instead of dim, and e.g. $...$ for $...$ instead of $... \ for\ ...$.

output of code

\documentclass{article} 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{diagrams}
\usepackage[document]{ragged2e}
\usepackage{wasysym}
\usepackage{tensor}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\tikzset{
  myarrow/.style={stealth-,shorten >=3pt,shorten <=3pt}
}
\pgfplotsset{
  lineplot/.style={
    black,
    dashed,
    very thin,
    samples y=0
  },
  coordinate line/.style={
    black,
    samples y=0
  },
  point/.style={
    only marks,
    mark=*,
    black,
    mark size=0.5pt
  }
}
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[section]


\begin{document}
    \begin{theorem}
        Let $\mathbf{M}$ be a smooth manifold and $p \in \mathbf{M}$; then $\dim(\mathbf{T_pM}) = dim(\mathbf{M})$
    \end{theorem}
    \begin{proof}
        To prove this, we construct a vector space basis for $\mathbf{T_pM}$ from a chart. Choose a chart $(U,x), with \  p \in U$. Consider $\dim(\mathbf{M})$ curves $\gamma_{(a)}$, with   $a = 1, \dots, \dim(\mathbf{M}), \gamma_{(a)} \colon \mathbb{R} \rightarrow U$, so that $(x^b \circ \gamma_{(a)}) (\lambda) = \delta^b_a \cdot \lambda$ for some $\lambda \in \mathbb{R}$ -- like this:

        \begin{tikzpicture}
            \begin{axis}[
                name=mfd,
                axis lines=none,
                declare function={
                    f(\x,\y)=10-(\x^2+\y^2);
                },
                declare function={
                    c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
                },
                declare function={
                    c_y(\t)=(sin(\t))/2-1;
                },
                declare function={
                    c_z(\t)=f(c_x(\t),c_y(\t));
                },
                declare function={
                    x_0(\t)=-1.2;
                },
                declare function={
                    x_1(\t)=0.8;
                }
            ]
                \addplot3[surf,domain=0:2,domain y=-2:0,]{f(x,y)};
                \addplot3[lineplot,variable=t,domain=0:360] ({c_x(t)},{c_y(t)},{c_z(t)});
                \addplot3[coordinate line,variable=t,domain=0:2] (t,{x_0(t)},{f(t,{x_0(t)})});
                \addplot3[coordinate line,variable=t,domain=-2:0] ({x_1(t)},t,{f({x_1(t)},t)});
                \addplot3[point] (1,-1,{f(1,-1)}) coordinate (a);
                \addplot3[point](.5,{x_0(.5)},{f(.5,{x_0(.5)})}) coordinate (x_dot);
                \addplot3[point]({x_1(-.5)},-.5,{f({x_1(-.5)},-.5)}) coordinate (y_dot);
            \end{axis}
            \draw [myarrow]  (x_dot) to[bend left] ++(-2cm,-4cm) node[below] {$\gamma_{(0)}$};
            \draw [myarrow]  (y_dot) to[bend right] ++(2cm,0.5cm) node [right] {$\gamma_{(1)}$};
            \begin{axis}[
                at={($(mfd.north east)+(1cm,-2cm)$)},
                anchor=north west,
                axis lines=none,
                declare function={
                    c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
                },
                declare function={
                    c_y(\t)=(sin(\t))/2-1;
                },
                declare function={
                    x_0(\t)=-1.2;
                },
                declare function={
                    x_1(\t)=0.8;
                }
            ]
                \addplot[lineplot,variable=t,domain=0:360]({c_x(t)},{c_y(t)});
                \addplot[point] (1,-1) coordinate (b);
                \addplot[coordinate line,variable=t,domain=0.6:1.4](t,{x_0(t)});
                \addplot[coordinate line,variable=t,domain=-1.5:-0.5]({x_1(t)},t);
                \addplot[point](.8,-.5) coordinate (P1);
                \addplot[point](.6,-1.2) coordinate (P2);
            \end{axis}
            \draw [myarrow] (b) to[bend right] node [above=7pt] {$x$} (a);
            \draw [myarrow] (P1) to[bend left] ++(-1cm,1cm) node[above] {$(x \circ \gamma_{(1)})$};
            \draw [myarrow] (P2) to[bend left] ++(-3cm,-1cm) node[above] {$(x \circ \gamma_{(0)})$};
        \end{tikzpicture}

        Given $p \in \mathbf{M}$, choose a chart $(U,x)$, so that $x(p)=0_{\mathbb{R}^{\dim M}}$, and curves $\gamma_{(a)}$, with $p = \gamma_{(a)}(0)$, for $a = 1, \dots, \dim M$:
        \begin{align*}
            e_a &:= X_{\gamma_{(a)},p}, a = 1, \dots, \dim M \\
            e_a f &= X_{\gamma_{(a)},p} f \\
            &=(f \circ \gamma_{(a)})' (0) \\
            &= (f \circ x^{-1} \circ x \circ \gamma_{(a)})' (0) \\
            &= \partial_b (f \circ x^{-1}) \cdot (x(\gamma_{(a)}(0))) \cdot (x^b \circ \gamma_{(a)})' (0) \\
            &= \partial_b (f \circ x^{-1})(x(p)) \cdot \delta^b_a \\
            &= \partial_a (f \circ x^{-1})
        \end{align*}
        (to be continued ...)
    \end{proof}
\end{document}