Both must and have to + the base verb mean it is necessary, you need to do it. (must often feels personal; have to often comes from a rule.) To talk about a past need, use had to: Yesterday I had to work late.
must and have to: it's necessary
I must finish this today.
You have to wear a seatbelt in the car.
She has to study for her exam.
Try it: It's the law: you ___ wear a seatbelt. (have to / have / must to) Answer: have to — It is necessary because of a rule, so use have to + the base verb: have to wear. "Have" alone is missing the to, and "must to" never takes a to (it is just must wear).
mustn't: it's not allowed
Mustn't + the base verb means it is forbidden, against the rules. It is not the same as "don't have to".
You mustn't smoke in here. (it is forbidden)
You mustn't park there.
Students mustn't use phones in the exam.
Try it: There is a NO SMOKING sign in the cafe. Smoking here is against the rules. Which fits something that is not allowed? (You mustn't smoke here. / You don't have to smoke here.) Answer: You mustn't smoke here. — Smoking is against the rules, so it is forbidden: You mustn't smoke. "You don't have to smoke" would mean smoking is your choice, which is not what a NO SMOKING sign means.
don't have to: you can choose
Don't have to / doesn't have to + the base verb means it is not necessary, you can choose. It is not forbidden.
You don't have to come if you're tired. (it's your choice)
She doesn't have to work on Sundays.
We don't have to wear a uniform here.
Try it: The party is just for fun. Amina would like Lars to come, but it is completely his choice. Which fits something that is optional? (You don't have to come. / You mustn't come.) Answer: You don't have to come. — Coming is his choice, not necessary, so use don't have to: You don't have to come. "You mustn't come" would mean he is forbidden to come, which is the opposite of a friendly invitation.
Try it: At the museum, touching the paintings is against the rules. At the museum, taking photos is allowed but completely up to you. Match each one. Which fits each rule? Answer: At the museum, touching the paintings is against the rules. → 1 → You mustn't touch the paintings. · 2 → You don't have to take photos. At the museum, taking photos is allowed but completely up to you. → 1 → You don't have to touch the paintings. · 2 → You mustn't take photos. — Touching is against the rules → mustn't (forbidden). Photos are your choice → don't have to (optional). Mustn't means not allowed; don't have to means you can choose.