1.I cooked kimchi fried rice.

1-1. Kimchi fried rice was cooked by me.

2. I cooked extra rice for guests.
2-1. Extra rice was cooked for guests by me.

2-2. Extra rice was cooked by me for guests.

(Are the passive forms all grammatical? Which one is right, #2-1 or #2-2?)

All are correct. 2-2 reads a bit more smoothly than 2-1.

Yes, all of the passive forms you have provided are grammatical. Both #2-1 and #2-2 are correct, but they have slightly different emphasis.

In #2-1, the focus is on the fact that extra rice was cooked specifically for guests. The phrase "for guests" is emphasized by placing it at the end of the sentence.

In #2-2, the focus is on the fact that you, specifically, cooked the extra rice. The emphasis is placed on "by me" by placing it at the end of the sentence.

So, the choice between #2-1 and #2-2 depends on what you want to emphasize in the sentence.