Consider first the finite product
$$\prod_{i = 1}^n (1+x^i).$$
If you expand it, you get
$$\prod_{i = 1}^n (1+x^i) = \sum_{\varepsilon \in \{0,\,1\}^n} x^{\sum_{i=1}^n \varepsilon_i \cdot i}.$$
The term $x^k$ occurs as many times in that sum, as there are ways to write $k$ as a sum of distinct positive integers $\leqslant n$.
For $k \leqslant n$, the coefficient doesn't change anymore when you multiply further factors $(1+x^i),\, i > n$.
Perhaps expanding the product in full for $n = 4$ helps a little:
$$\begin{align}
(1+&x)(1+x^2)(1+x^3)(1+x^4)\\
&= 1\cdot 1\cdot 1 \cdot 1 + 1\cdot 1\cdot 1\cdot x^4 + 1\cdot 1 \cdot x^3 \cdot 1 + 1\cdot 1 \cdot x^3 \cdot x^4\\
&\;+ 1\cdot x^2 \cdot 1\cdot 1 + 1\cdot x^2\cdot 1\cdot x^4 + 1\cdot x^2 \cdot x^3 \cdot 1 + 1\cdot x^2 \cdot x^3 \cdot x^4\\
&\;+ x^1\cdot 1\cdot 1 \cdot 1 + x^1\cdot 1\cdot 1\cdot x^4 + x^1\cdot 1 \cdot x^3 \cdot 1 + x^1\cdot 1 \cdot x^3 \cdot x^4\\
&\;+ x^1\cdot x^2 \cdot 1\cdot 1 + x^1\cdot x^2\cdot 1\cdot x^4 + x^1\cdot x^2 \cdot x^3 \cdot 1 + x^1\cdot x^2 \cdot x^3 \cdot x^4\\
&= 1 + x^4 + x^3 + x^7\\
&\; + x^2 + x^6 + x^5 + x^9\\
&\;+ x^1 + x^5 + x^4 + x^8\\
&\;+ x^3 + x^7 + x^6 + x^{10}\\
&= 1\cdot x^0 + 1\cdot x^1 + 1\cdot x^2 + 2\cdot x^3 + 2\cdot x^4 + 2\cdot x^5 + 2\cdot x^6 + 2\cdot x^7 + 1\cdot x^8 + 1\cdot x^9 + 1\cdot x^{10}.
\end{align}$$
From each factor, we can choose either the $1 (= x^0)$ or the $x^i$ term. That gives $2^n$ products in total. Then we group these products by the resulting exponent of $x$.
Each of the $2^n$ products corresponds to one partition of an exponent into a sum of distinct positive integers, and each partition of $k$ into a sum of distinct positive integers $\leqslant n$ corresponds to one choice of the $x^0$ or the $x^i$ term of each factor.
In the "Update" (the day after the Question itself was posted), the OP mentions a recursion for counting the partitions of $n$ into $k$ distinct parts, each part at most $M$:
$$ p_k(\leq M, \mathcal{D},n) =
p_{k-1}(\leq M-1, \mathcal{D},n-k) +
p_k(\leq M-1, \mathcal{D},n-k) $$
and asks "How can I prove this?".
To see this, separate the required partitions on the basis of whether $1$ appears as a summand. If it does, then subtracting $1$ from each summand produces a partition of $n-k$ with exactly $k-1$ distinct parts (since the original summand $1$ disappears), each part at most $M-1$. These partitions are counted by the first term on the right-hand side of the recursion. Otherwise the summand $1$ does not appear, and subtracting $1$ from each part resulting in a partition of $n-k$ with exactly $k$ distinct parts, each part at most $M-1$. These cases are counted by the second term.
Note that a partition of $n$ with $k$ distinct parts exists if and only if $n \ge \binom{k+1}{2}$, because the ascending summands $m_1 + \ldots + m_k = n$ must satisfy $m_i \ge i$. If $n = \binom{k+1}{2}$, then there is just one such partition with $k$ distinct parts, the largest of which is $k$. Repeated application of the recursion will culminate with terms which we can evaluate "by inspection" as either zero or one.
By itself this recursion doesn't seem to give us an especially attractive way of evaluating $p_k(\leq M, \mathcal{D},n)$. Like the recursion for Fibonacci numbers, as a top-down method it suffers from recalculating terms multiple times (giving exponential complexity), so we would be better off working with it as a bottom-up method (giving polynomial complexity).
Better for large parameters is to close the circle with the ideas presented by @NikosM. by showing how the evaluation of $p_k(\leq M, \mathcal{D},n)$ can be reduced to counting restricted partitions without requiring distinct summands.
Prop. Suppose that $n \gt \binom{k+1}{2}$. Then the following are equal:
$(i)$ the number of partitions of $n$ into exactly $k$ distinct parts, each part at most $M$, i.e. $p_k(\leq M, \mathcal{D},n)$
$(ii)$ the number of partitions of $n - \binom{k}{2}$ into exactly $k$ parts, each part at most $M$
$(iii)$ the number of partitions of $n - \binom{k+1}{2}$ into at most $k$ parts, each part at most $M$
Sketch of proof: Once we know the ordered summands of partitions in $(i)$ satisfy $m_i \ge i$, it is easy to visualize their equivalents in $(ii)$ and $(iii)$ by Young tableaux, also called Ferrers diagrams. We remove a "base triangle" of dots corresponding to the first $i$ dots in the $i$th summand (since $m_i \ge i$) to get case $(iii)$, and remove one fewer dot in each summand to preserve exactly $k$ summands in case $(ii)$. These constructions are reversible, and the counts are equal.
Remark 1 If $n \le \binom{k+1}{2}$, $p_k(\leq M, \mathcal{D},n)=1$ if $n=\binom{k+1}{2}$ and $k \le M$ and otherwise $p_k(\leq M, \mathcal{D},n)=0$.
Remark 2 For fixed $k,n$, suppose $M_0 = n - \binom{k}{2} \gt 0$. Then for all $M \ge M_0$, $p_k(\leq M, \mathcal{D},n) = p_k(\leq M_0, \mathcal{D},n)$. That is, further increasing the upper bound $M$ on the size of parts will not yield additional partitions of $n$ with exactly $k$ distinct parts.
Recommended Reading
Andrews, George E. The Theory of Partitions (Cambridge University Press, 1998)
A modern classic for theory of integer partitions, reviewed by Richard Askey in BAMS.
Best Answer
Who needs generating functions? We can set up a correspondence between distinct partitions and odd partitions by means of two inverse procedures, which I call doubling and halving.
Given an odd partition
$13=3+3+3+1+1+1+1$
we double identical pairs -- $1+1\to 2, 3+3\to6$. Note that one of the $3$'s remains unpaired because we had an odd number of them:
$13=6+3+2+2$
And then we double again with the remaining identical pair of $2$'s, which leaves us ultimately with only single numbers thus a distinct partition into which the odd partition is mapped:
$13=6+4+3$
Now go the other way. Start with a distinct partition such as
$13=6+4+3$
and split each even number in half, iterating until only odd numbers are left:
$13=3+3+2+2+3=3+3+3+2+2$
$13=3+3+3+1+1+1+1$
Thus doubling uniquely maps $3+3+3+1+1+1+1$ into $6+4+3$ and halving uniquely maps $6+4+3$ back into $3+3+3+1+1+1+1$.
What's really happening?
Bit by bit
Let's look closely at the evolution of the $3$'s from the odd partition. In binary arithmetic there are $11_2$ of these. Doubling therefore inevitably leads to one term equal to $2×3$, from the first $1$ bit, plus $1×3$ from the second $1$ bit. Thus in base ten, $3+3+3\to6+3$. And if we start from a distinct partition with $6+3$ where $6$ and $3$ are the only numbers with $3$ as the largest odd factor, halving is sure to give $11_2$ threes or $3+3+3$.
We can see the same thing with the $1$'s. The odd partitions started with $100_2$ of these terms, so repeatedly doubling can't leave any terms of $1×1$ or $2×1$. We can only get a term of $4×1$ from the $1$ bit in $100_2$, and going the other way $4$ which is $1×2^2$ can generate a string of $1$'s that is $100_2$ or four terms long.
Similar correspondences hold in general connecting each odd partitions uniquely with a distinct one. Let's look at all of them for $13$:
$13\to13$*
$11+1+1\to11+2$
$9+3+1\to9+3+1$
$9+1+1+1+1\to9+4$
$7+5+1\to7+5+1$
$7+3+3\to7+6$
$7+3+1+1+1\to7+3+2+1$
$7+1+1+1+1+1+1\to7+4+2$
$5+5+3\to10+3$
$5+5+1+1+1\to10+2+1$
$5+3+3+1+1\to6+5+2$
$5+3+1+1+1+1+1\to5+4+3+1$
$5+1+...+1\to8+5$
$3+3+3+3+1\to12+1$
$3+3+3+1+1+1+1\to6+4+3$
$3+3+1+...+1\to6+4+2+1$
$3+1+...+1\to8+3+2$
$1+...+1\to8+4+1$#
*A partition that is both distinct and odd maps into itself.
#An odd partition of all $1$'s maps into the binary representation of the number, which dovetails with the arguments above.