What is the grammatical relationship between these two words?
Are they just different words expressing the same concept, is one the derivation of the other or is a third option true?
だ is a conclusive copula, etymologically a contraction of で+ある. It is used sentence-finally (hence the name "conclusive"). The uncontracted form is still available in Modern Japanese, but it's somewhat different in distribution and more formal. だ isn't actually a verb―it cannot stand alone and doesn't inflect like a verb. で+ある isn't a verb either, but it is a construction containing the verb ある. The copular で is a contraction of literary にて.
な is an adnominal copula, etymologically a contraction of なる from に+ある. It is used before nouns (hence the name "adnominal"). The uncontracted form なる is now very limited and―outside of the literary register―usually only appears with specific words such as 聖なる that can now be viewed as lexical exceptions.
The two can be now viewed as forms of the same thing. Etymologically, the difference is that だ contains て, but な does not:
(に+て)+あり → にて+あり → で+ある → であ → だ (conclusive copula)
に +あり → に +あり → なり → なる → な (adnominal copula)
Etymologically speaking, both だ and な contain the Old Japanese copula infinitive に n-i
, which is related to the adnominal copula の n-o
, which was present in Old Japanese and is still around today:
(n-i+て)+あり → にて+あり → で+ある → であ → だ (conclusive copula)
n-i +あり → に +あり → なり → なる → な (adnominal copula)
n-o → の (adnominal copula)
In other words, all three forms descend from the same Old Japanese defective copula n-
. Note that in traditional grammar, the adnominal copula の is not analyzed as a copula and is instead treated as a use of the genitive case particle の. You can find it in monolingual Japanese dictionaries listed as expressing 同格の関係 ("an appositive relationship").
In modern Japanese, we find all three forms in alternation, and they can all be considered forms of the same thing. Generally speaking, だ is used clause-finally ("conclusively"), while な and の are used before nouns ("adnominally"). Specifically:
So we find:
きれいだ 〜 きれいな花 (きれい is a な-adjective) 病気だ 〜 病気の人 (病気 is a の-adjective, a special type of noun) 弟だ 〜 弟の太郎 (弟 is a regular noun) 病気だ 〜 病気なのだ (な is used before certain grammatical words such as の)
In traditional grammar, の-adjectives are simply considered nouns, and for our purposes here we can follow the same line of thinking. The boundary between the noun and な-adjective categories is rather fluid in any case, and many words belong to both categories.
Note that in traditional grammar, だ is analyzed as a separate word when it follows a noun, but an inflectional ending when it follows a な adjective (形容動詞). Most modern grammars depart from traditional grammar on this point and present だ as a separate word in all cases, as I've done here.
References, by request: