"dan" is a conjunction, which can be translated as "and". I think the use of "dan" is exactly the same as the use of "and" in English, no differences.
In case of "yang" and "nan", they have the same meaning, but the use of "nan" is restricted only for poem and its kind. If you use "nan" in a daily conversation, the people you talk to will squirm :).
You MOSTLY find "yang" and "nan" in a relative clause and they act as relative pronouns, or what we know in English as "which", "that", "who", "whom", "whose". Good news for you, you use "yang" for all types of relative pronouns (how great is that!).
Examples:
- the book, WHICH I borrowed from him, was very interesting ==> buku itu, YANG saya pinjam darinya, sangat menarik.
- the house THAT she built is large ==> rumah YANG dia bangun besar.
- do you know the girl WHO is talking to Jeff? ==> apakah kamu mengenal wanita YANG sedang berbicara dengan Jeff?.
- Sarah, WHOM I like, is very polite ==> Sarah, YANG saya sukai, sangat sopan.
- Laura, WHOSE book I borrowed, is a teacher ==> Laura, YANG bukunya saya pinjam, adalah seorang guru.
Well, the use of "yang" is quite extensive once you study it deeper. But when you cannot really differentiate it between "nan" and "dan", giving more explanation will only drive you insane.
Feel free to ask if you find "yang" in different cases and I will try to explain it further.