How to remove junction box?
That screw in the middle is attaching it to a steel bar that spans between your rafters. The ends of the bar will be nailed into the rafters so you will not be able to get that pout without damaging your ceiling. But the box itself should come off.



If you loosened it and the whole box spins now, you are kind of in a mess because you can't get behind it to hold the nut that is likely BEHIND the bar. Usually the bar is a U-shaped channel and the nut is inside of the U so that it can't spin, but if you can't back it all the way out (assuming you tried) then it's likely that someone installed it upside down before hanging the sheetrock, when they could tighten that nut by getting to the back side with a wrench. Now that it's loose you may not be able to loosen it the rest of the way OR tighten it back up.

First thing though, make sure you tried to take it all the way out, the screw may be over an inch long so maybe you just gave up too soon. If that doesn't work, you can TRY to put downward pressure on the box to try to get it to hold the nut in the back in place until the screw can back out. So to do that, screw something into the mounting holes on the side so that you can pull on it or hand something heavy from it.

Good luck!