Kohanim were commanded to eat the flesh of certain sacrifices, in this case the chatas (sin offering) and the asham (guilt offering). The Talmud in Pesachim (59b) explains that this is an integral part of the sacrifice; the one who brought the offering does not receive his atonement until the kohanim have eaten from it. The Rambam cites the Sifra on parshas Shemini, which asks, “How do we know that eating these sacrifices effects atonement?” It responds with Leviticus 17, in which Moshe asked Aharon, “Why didn’t you eat the sin offering in a holy place? God gave it to you to acquire forgiveness for the sin of the people and get atonement for them …” The Midrash concludes, “The kohanim eat and the owners of the sacrifice are forgiven.”
There are different rules for different offerings. Some were eaten by their owners; others were burned in their entirety. In the case of the chatas and the asham, the kohanim ate the flesh in the courtyard of the Temple and the fats were burned on the altar. The people who brought these particular sacrifices did not eat from them.
This mitzvah includes that kohanim should eat from all sacrifices of a category called “kodshim kalim” (i.e., of a lesser degree of sanctity), including terumah. However, in the case of other kodshim kalim and terumah, failure on the part of the kohanim to eat does not affect the one who brought them. Only failure to eat from the chatas or asham affects the owner of the sacrifice (by impeding the completion of his atonement process).
The underlying rationale of this mitzvah is that these sacrifices, upon which people rely to complete their atonement, should be taken seriously. These sacrifices must be eaten by the kohanim themselves, who are the ones who facilitate the atonement process, rather than given to their household servants, fed to their animals or sold in the market. It is for similar reasons that these sacrifices had to be consumed in the Temple; this assured that they would be eaten quicker than those portions that could be brought home.
The mitzvah for the kohanim to eat from these sacrifices applies to male kohanim when the Temple is standing. It is discussed in the Talmudic tractate of Zevachim on pages 54b-55a and elsewhere. It is codified in the Mishneh Torah in the tenth chapter of Hilchos Maaseh HaKarbanos. It is #89 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos. The Ramban (Nachmanides) does not consider this an independent mitzvah, including it among the details of the sacrifices.