Obligatory Sunday Mass—the year-round holy day of obligation—stems from God’s commandment to keep holy the Sabbath. The Christian “Sabbath” moved naturally from the Jewish-observed Saturday to Sunday to commemorate the Resurrection, the “eighth day,” “outside time,” that celebrates our salvation and anticipates our final happiness, union with God in heaven.
Strictly speaking, the Sunday obligation is a discipline of the Church (see here.) Moreover, the obligation is dispensed with if you are, for example, in a situation where it is well and truly impossible for you to attend mass. For example, in earlier times (or still today in certain parts of the world) where there is no Mass near you and/or there is no transportation to get to the Mass.
Other holy days of obligation follow a similar logic. Apart from the commandment to keep holy the Lord’s Day, these imposed obligations carry the weight of the authority of the Vicar of Christ: “Whatever you bind on earth shall be bound in heaven.” The obligations exist for the good of souls: to engage us in the life of the Church and the liturgical year, to give us a tug forward by the hand when attachment to sin or spiritual weariness might see us ready to abandon our daily taking up of our cross and following Christ.
Catholic Answers notes, “The precepts of the Church are not opposed to, nor are they outside of, the Commandments of God. They are within those Commandments and are intended to help keep the faithful within the Commandments.” [x]
There is a good short article about feast days/holy days of obligation at the Catholic Encyclopedia.
You may also be interested in:
I hope this helps.