How to uninstall this tricky P trap?
You indicate that the fittings will spin, but not unscrew. That indicates to me that they are some sort of a "snap" fitting that goes on, but either has to have a special tool to remove or has to be cut off.

You say you're REPLACING the trap. In that case, using a hacksaw* to cut it out is probably the simplest and most expedient method of removal.

HOWEVER - If you cut the drain tail-piece (the one you're holding on to), it's quite likely that you will not have enough pipe left to attach a new, standard screw-on trap to. To that end, I'd suggest that you also purchase a new tail piece for your sink with the expectation that you'll have to replace it. Keep your receipt and return it if you end up not needing to replace it.

An alternative would be to hacksaw through the fitting along the length of the pipe to cut it open and allow you to spread it so you can remove the trap. You might need to make 2 cuts, to cut the fitting in half so you can simply lift each part of the fitting off. This will preserve the full length of the drain tail-piece, but will probably be a more difficult cut to make. You may be able to make the 2 cuts roughly 1/4 - 1/3 the pipe circumference from each other and stretch the fitting the rest of the way to get it off if you can't get to the back side to make them 1/2 circumference apart. Of course, if the fitting is rotating freely, make one cut, spin it 1/2 way around, then make the other cut.

*I keep seeing "HACK" on the pipe, just above your thumb and keep thinking that's a hint. :D