When swapping bike pedals, screw torque can be a real problem to overcome. Here is one solution I found works very well.
So I get the hex key / Allen wrench that fits the pedal's screw. No way I can turn that to get the pedal off.
Then I also fetched a long steel tube that I had sitting around.
I put the hex key into the pedal's screw and place the tube over it. With this long steel tube, the lever is massively increased.
Now the pedal screw comes off like butter. I just push against it with a foot so it does not wiggle too much, and with a push against the top and mild bend of the steel tube, the screw yields.
This is far better than hammering that I see as an uncontrolled force type exaggeration here. It may work but it also may be damaging. In particular, one might exceed the required force to get the screw going.
Having done this a few times with various approaches, I can assure you that this is by far the fastet, easiest and quickest way to do it.
Keywords pedals mountain bike road bike bicycle swap removing removal hex key screw driver