[guided]The purpose of this step is to replace a possibly new function in the forcing extension by old, ground-model approximations to all of its possible values.
Fix $p \in \mathbb{P}$, ordinals $\mu,\lambda \in M$, and a $\mathbb{P}$-name $\dot{f} \in M$ such that
\begin{align*}
p \Vdash_{\mathbb{P}} \dot{f}: \mu \to \lambda.
\end{align*}
For a fixed coordinate $\xi < \mu$, we want to know which values $\dot{f}(\xi)$ can take below $p$. Define
\begin{align*}
D_\xi := \{q \in \mathbb{P} : q \leq p \text{ and there is some } \alpha < \lambda \text{ such that } q \Vdash_{\mathbb{P}} \dot{f}(\xi)=\alpha\}.
\end{align*}
This set is dense below $p$. Namely, if $r \leq p$, then because $p$ forces $\dot{f}$ to be a function from $\mu$ to $\lambda$, the condition $r$ can be refined to a condition $q \leq r$ deciding the value of the name $\dot{f}(\xi)$ as some ordinal $\alpha < \lambda$.
Now choose, inside $M$, a maximal antichain $B_\xi \subseteq D_\xi$ below $p$. This is legitimate in $M$ because $M$ satisfies ZFC, and the set $D_\xi$ is definable in $M$ from $p$, $\dot{f}$, $\xi$, $\mu$, $\lambda$, and $\mathbb{P}$ by definability of the forcing relation. This is where the chain condition enters. Since $B_\xi$ is an antichain in $\mathbb{P}$ and $M$ satisfies that $\mathbb{P}$ is $\kappa$-c.c., $M$ satisfies
\begin{align*}
|B_\xi| < \kappa.
\end{align*}
Each $q \in B_\xi$ decides $\dot{f}(\xi)$, so choose in $M$ an ordinal $\alpha_q < \lambda$ with
\begin{align*}
q \Vdash_{\mathbb{P}} \dot{f}(\xi)=\alpha_q.
\end{align*}
Define the ground-model set of possible values at coordinate $\xi$ by
\begin{align*}
A_\xi := \{\alpha_q : q \in B_\xi\}.
\end{align*}
Then $A_\xi \in M$, $A_\xi \subseteq \lambda$, and $M$ satisfies $|A_\xi| < \kappa$, because $A_\xi$ is the image of $B_\xi$ under the map $q \mapsto \alpha_q$.
It remains to check that $A_\xi$ really captures all possible values below $p$. Suppose toward a contradiction that $p$ does not force $\dot{f}(\xi) \in A_\xi$. Then there is some $r \leq p$ such that
\begin{align*}
r \Vdash_{\mathbb{P}} \dot{f}(\xi) \notin A_\xi.
\end{align*}
Since $B_\xi$ is maximal among conditions below $p$, the condition $r$ is compatible with some $q \in B_\xi$. Choose $s \in \mathbb{P}$ with $s \leq r$ and $s \leq q$. The condition $q$ forces $\dot{f}(\xi)=\alpha_q$, and $\alpha_q \in A_\xi$ by definition. Hence $s$ forces $\dot{f}(\xi) \in A_\xi$. But $s \leq r$, so $s$ also forces $\dot{f}(\xi) \notin A_\xi$. This contradiction proves
\begin{align*}
p \Vdash_{\mathbb{P}} \dot{f}(\xi) \in A_\xi.
\end{align*}[/guided]