when does the copula become "な"?
Simply, だ turns into な when it modifies the following noun, which is の/ん in this case. な is the attributive form of the copula だ. So-called na-adjectives and ordinary nouns are technically both nouns, so they share the similar grammar pattern.
This の/ん is a tiny special noun commonly referred to as explanatory-no. This の/ん is a big topic in Japanese, so please read these first:
So, 夢なのだ/夢なんだ has an added nuance as compared to simple 夢だ. "スミスさんは将来日本の会社で働くのが夢なんだって" may be used in the following situations:
- When this sentence works as an explanation/clarification of the previous context.
- When this sentence works as a preliminary remark (i.e., background information).
- When you just realized this fact.