[proofplan]
The forward direction is obtained by evaluating noncommutative polynomials at the given self-adjoint variables and using positivity of the ambient state. For the converse, the noncommutative polynomial algebra itself is used as the ambient unital $*$-algebra, with the coordinate generators as the random variables and $\mu$ as the state. The assumed square-positivity is exactly the positivity axiom for this algebraic state, and $\mu(1)=1$ gives normalization.
[/proofplan]
[step:Evaluate polynomials at the given self-adjoint variables]
Assume first that $\mu$ is the joint law of self-adjoint elements $a_1,\dots,a_d$ in an algebraic noncommutative probability space $(\mathcal{A},\varphi)$. Thus $\mathcal{A}$ is a unital complex $*$-algebra, $\varphi:\mathcal{A}\to\mathbb{C}$ is a positive unital linear functional, $a_i^*=a_i$ for every $i \in \{1,\dots,d\}$, and
\begin{align*}
\mu(P)=\varphi(P(a_1,\dots,a_d))
\end{align*}
for every $P\in \mathbb{C}\langle X_1,\dots,X_d\rangle$.
Define the evaluation homomorphism
\begin{align*}
\operatorname{ev}_a:\mathbb{C}\langle X_1,\dots,X_d\rangle &\to \mathcal{A}
\end{align*}
to be the unique unital algebra homomorphism satisfying $\operatorname{ev}_a(X_i)=a_i$ for every $i \in \{1,\dots,d\}$. Since the generators $X_i$ and $a_i$ are self-adjoint, $\operatorname{ev}_a$ is a $*$-homomorphism, so
\begin{align*}
\operatorname{ev}_a(P^*P)=\operatorname{ev}_a(P)^*\operatorname{ev}_a(P).
\end{align*}
Therefore, for every $P\in \mathbb{C}\langle X_1,\dots,X_d\rangle$,
\begin{align*}
\mu(P^*P)=\varphi(\operatorname{ev}_a(P)^*\operatorname{ev}_a(P)).
\end{align*}
By positivity of $\varphi$, the right-hand side belongs to $[0,\infty)$. Hence $\mu(P^*P)\in[0,\infty)$ for every $P$.
[/step]
[step:Use the polynomial algebra itself as the ambient probability space]
Assume conversely that
\begin{align*}
\mu(P^*P)\in[0,\infty)
\end{align*}
for every $P\in\mathbb{C}\langle X_1,\dots,X_d\rangle$. Set
\begin{align*}
\mathcal{A}:=\mathbb{C}\langle X_1,\dots,X_d\rangle
\end{align*}
with its standard unital $*$-algebra structure, and define
\begin{align*}
\varphi:\mathcal{A} &\to \mathbb{C}
\end{align*}
by $\varphi(P):=\mu(P)$ for every $P\in\mathcal{A}$.
The map $\varphi$ is complex-linear because $\mu$ is complex-linear. It is unital because $\varphi(1)=\mu(1)=1$. It is positive because for every $P\in\mathcal{A}$,
\begin{align*}
\varphi(P^*P)=\mu(P^*P)\in[0,\infty).
\end{align*}
Thus $(\mathcal{A},\varphi)$ is an algebraic noncommutative probability space.
[guided]
We now build the probability space directly from the moment functional. The natural ambient algebra is
\begin{align*}
\mathcal{A}:=\mathbb{C}\langle X_1,\dots,X_d\rangle,
\end{align*}
equipped with the standard involution: coefficients are conjugated, words are reversed, and each generator satisfies $X_i^*=X_i$. This choice is forced by the desired self-adjointness of the random variables: the coordinate elements $X_1,\dots,X_d$ are self-adjoint in this $*$-algebra by definition.
Define the candidate state
\begin{align*}
\varphi:\mathcal{A} &\to \mathbb{C}
\end{align*}
by $\varphi(P):=\mu(P)$ for every polynomial $P\in\mathcal{A}$. To verify that this is an algebraic noncommutative probability space, we check the state axioms. First, $\varphi$ is complex-linear because it is equal to the complex-linear functional $\mu$. Second, $\varphi$ is normalized because
\begin{align*}
\varphi(1)=\mu(1)=1.
\end{align*}
Third, $\varphi$ is positive: for every $P\in\mathcal{A}$, the hypothesis gives
\begin{align*}
\varphi(P^*P)=\mu(P^*P)\in[0,\infty).
\end{align*}
These three facts show that $\varphi$ is a positive unital linear functional on the unital $*$-algebra $\mathcal{A}$. Therefore $(\mathcal{A},\varphi)$ is an algebraic noncommutative probability space.
[/guided]
[/step]
[step:Identify the joint law of the coordinate generators]
For each $i\in\{1,\dots,d\}$, let
\begin{align*}
a_i:=X_i\in\mathcal{A}.
\end{align*}
Since $X_i^*=X_i$ in the standard involution, each $a_i$ is self-adjoint.
Let
\begin{align*}
\operatorname{ev}_X:\mathbb{C}\langle X_1,\dots,X_d\rangle &\to \mathcal{A}
\end{align*}
be evaluation at the coordinate tuple $(X_1,\dots,X_d)$. This map is the identity homomorphism on $\mathbb{C}\langle X_1,\dots,X_d\rangle$. Hence, for every $P\in\mathbb{C}\langle X_1,\dots,X_d\rangle$,
\begin{align*}
\varphi(P(a_1,\dots,a_d))=\varphi(P)=\mu(P).
\end{align*}
Thus the joint law of the self-adjoint tuple $(a_1,\dots,a_d)$ in $(\mathcal{A},\varphi)$ is exactly $\mu$. This proves the converse implication and completes the proof.
[/step]