What do you mean the iron pipe spins?????
Assuming the iron pipe is the supply and the csst tubing is the appliance side, the iron pipe should not be "spinning". Now you got me worried that a connection loosened up further back. Check that out
Make sure the GAS, or an upstream valve is off !
OK, enough shouting.
The number one mistake of gas rookies is over-tightening. Remember that gas pressure is so low most leaks can be stopped with your finger or some sticky chewing gum. And do not use heat as suggested, eyebrows take weeks to grow back.
Also don't use ViceGrip pliers. They are too powerful and can squeeze so hard as to crack a cast fitting.
Use pipe wrenches as suggested above. You need 2, small ones are better, a pair of 10" or 8" would be good here.
As Harvey mentioned apply the wrenches in opposite directions, decide which part will move, and which part is stationary.
Then hold the stationary wrench with one hand, while pushing or pulling the other to remove fitting.
It's much easier doing it than describing it.
Since you've been to the store, did you get a Cap for the pipe, or a Plug for the coupling?