How to properly fix dry wall tearing away
Fix the leak first - this appears to be water damaged, so replacing it without stopping the source of water will be pointless, as the replacement will be water-damaged again. Probably the leak is associated with the window (though it could potentially be coming from anywhere higher, all the way to the roof.)

Once the leak is stopped, you cut back to sound drywall and replace the damaged section.