Bought a new house and noticed discoloration near the top corners of the drywall (Where the drywall meets the window). I chipped away at the moldy drywall. Wondering what type of product I should use to seal between the window and the wood frame (Would some type of caulk be appropriate?) Also how should I replace the drywall? Would using hot mud to deep fill this area work?
These look like aluminum windows. Most likely the problem here isn't water intrusion, but the windows "sweating" in the winter. The water then gets wicked up by the drywall about 1-2" from the window itself.
Your first option is to replace the windows with vinyl. That will provide you with better insulation overall and you can eliminate the sweating entirely. This is also expensive and difficult.
The second option is to tear down the drywall next to the windows and put up, say, 1x4 vinyl planking. Since you'll be tearing out the metal casing along the edge too, what I would suggest is casing the wall around the window in door casing. It will hide the ripped-out drywall damage and, once caulked, it will look quite attractive.
The proper way to fix that drywall is to take the whole band of the material that is around the window opening. That will include removing the metal corner pieces that wrap from the band out to the flat of the wall. Then cut new pieces of drywall and nail or screw into place. Finally install replacement metal corner pieces to wrap the corners. (Note it will not be reasonable to try to reuse the old corner because it gets pretty bent up as you remove it).
Once you have that done the final finishing it to re-mud the window band and the corner. Once dry sand, prime and repaint.