Piggul, literally something disgusting or repulsive, refers to a sacrifice offered with improper intentions. For example, if the kohein who officiates intends to eat from the sacrifice after its permitted time frame, that renders the sacrifice piggul and it is disqualified. Other thoughts that would disqualify a sacrifice as piggul include the intention to eat the offering outside of its designated location and the intention to offer an animal as a type of offering other than the one for which it was designated (for example, offering an animal as a free-will offering rather than as the sin offering for which it had been designated).
A sacrifice would also be considered piggul if the kohein intended to burn the portion that is offered up after its proper time. The part that is burned on the altar is also called “eaten.” That is, part of an offering may be consumed by the kohein, but other parts are consumed by fire on the altar.
The basis of this mitzvah is apparent: the purpose of a sacrifice is to draw people closer to God. It’s pretty reprehensible to do something designed to strengthen our connection to Him while simultaneously plotting to metaphorically stab Him in the back by violating the rules of the sacrifice. That’s two-faced behavior towards God and the result of such an intention is rightly called “detestable.”
Some more facts about piggul:
• Piggul did not only apply to animal sacrifices; flour offerings were also subject to piggul;
• Piggul is a very serious offense; the penalty for eating it is kareis (spiritual excision);
• If one entertained improper thoughts while offering a sacrifice, that is in and of itself a violation of the command “he may not intend this,” even without eating from it. However, this is not listed separately in the 613 mitzvos as it is included in Mitzvah #287, the prohibition against causing a sacrifice to become disqualified (in parshas Emor).
While the kohanim were the ones in a position to make a sacrifice piggul, the prohibition on eating it applied to everyone in Temple times. This mitzvah is discussed in the Talmud in the Order of Kodshim. It is dealt with heavily in the tractate of Zevachim, beginning on page 27a. It is codified in the Mishneh Torah in the thirteenth chapter of Hilchos Pesulei HaMukdashin. It is #132 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.