In order to understand which of these two is most appropriate for what you are trying to say, you should think about their literal translations. Duerfen is "to be allowed to", expressing permission, and muessen is more "to need to" expressing "must". So, if you were to say "Ich muss das Abendessen kochen" it incinuates that the action must be done, and "Ich darf das Abendessen kochen" would show that you have been give the permission to do the cooking.
However it is worth being wary about using these two in the negative, as while we in English say "I must not cook dinner", one would use duerfen and not muessen when translating this into German, as the sentence expresses a lack of permission, so "Ich darf das Abendessen nicht kochen". "Ich muss das Abendessen nicht kochen" instead would mean "I do not need to cook dinner", incinuating that you have the permission but not the need.