Commentary for Chagigah 2:6
הַטּוֹבֵל לְחֻלִּין וְהֻחְזַק לְחֻלִּין, אָסוּר לְמַעֲשֵׂר. טָבַל לְמַעֲשֵׂר וְהֻחְזַק לְמַעֲשֵׂר, אָסוּר לִתְרוּמָה. טָבַל לִתְרוּמָה, וְהֻחְזַק לִתְרוּמָה, אָסוּר לְקֹדֶשׁ. טָבַל לְקֹדֶשׁ וְהֻחְזַק לְקֹדֶשׁ, אָסוּר לְחַטָּאת. טָבַל לְחָמוּר, מֻתָּר לְקַל. טָבַל וְלֹא הֻחְזַק, כְּאִלּוּ לֹא טָבָל:
[This is another level (in purification):] If one immerses for chullin and intends [this immersion to cause him] to be eligible for chullin, he is forbidden to [eat second] tithe, [which is eaten in Jerusalem — until he immerses specifically for tithe — and so with all.] If he immersed for tithe and were eligible for tithe, he is forbidden to (eat) terumah. If he immersed for terumah and were eligible for terumah, he is forbidden to (eat) kodesh. If he immersed for kodesh and were eligible for kodesh, he is forbidden to (touch) chatath [the water sanctified with the ashes of the red heifer.] If he immersed for the more stringent, he is permitted to (eat) the less stringent. If he immersed and did not intend to be eligible (for anything), it is as if he did not immerse [for tithe, and, it goes without saying, for terumah and kodesh, but it is (valid) immersion for chullin, chullin not requiring intent.]
Bartenura on Mishnah Chagigah
English Explanation of Mishnah Chagigah
If he immersed for [second] tithe, and was presumed to be fit to eat [second] tithe, he is prohibited from [eating] terumah.
If he immersed for terumah, and was presumed to be fit to eat terumah, he is prohibited from [eating] holy things.
If he immersed for holy things, and was presumed to be fit to eat holy things he is prohibited from [touching the waters of] purification.
If one immersed for something possessing a stricter [degree of holiness], one is permitted [to have contact with] something possessing a lighter [degree of holiness].
If he immersed but without special intention, it is as though he had not immersed.
This mishnah deals with the intention that one has to have when one immerses. There are various levels of holy objects ranked below from lowest to highest:
1) Unconsecrated food.
2) Second tithe (eaten by its owners in Jerusalem).
3) Terumah (separated from produce and given to priests).
4) Sacrifices
5) The waters of purification made from the ashes of the red heifer.
The general rule of the mishnah is quite clear and stated explicitly at the end of the mishnah itself. If one immerses with the intention of eating a less holy thing, say unconsecrated food, he cannot count that immersion in order to eat a more holy thing. He would have to immerse again to eat the more holy thing. However, if one immerses with the intention of eating a holy thing, say a sacrifice, that immersion counts for eating a less holy thing such as terumah. Finally, if one immerses without any specific intention in mind, the immersion doesn’t count.
This explanation should aid in explaining the whole mishnah, so you will not see a fuller explanation below.