As others have said, best to remove cooler and GPU from case. Might want to remove PSU as well because it's only mounted to back of case. So if case is bounced around it can be torn loose, then damage other components.
Is it safe to assume you have an AMD AM4 CPU? Start system, run a heavy load for a few minutes, shutdown and then try removing cooler. Gently twist clockwise/anticlockwise, maybe gently tilt / angle cooler so there is slightly less pressure on one corner than others to get it to release. Heating old TIM often looses lockup.
I've used dental floss to cut TIM loose a time or 2.
Cut a long piece and get it under the cooler base. Make sure it's between IHS and cooler base, not CPU PCB and IHS, then pull ends back and forth in a sawing action to get it to cut it's way in. Really need to remove mobo from case to do this.
Video link review below shows how to get CPU off of cooler if it comes out of socket.
https://www.youtube.com/watch?v=HCSatTjwdzE