Do you want to keep the box in a reusable state? Could use a multi-tool with steel cutting blade to take head off or try and get a crowbar in behind the box and force it off although I’m not familiar with that type of fixing.
I suspect that nail will not come out easily probably put in with a nail gun. If the box is no longer required you could probably get a chisel and cut the box off it and then it maybe easier to get out or just knock into the wall.