Repairing Water Damage on a Window Frame?
A few thoughts - more than I can fit in comments but probably not a complete answer. Also a disclaimer that I'm not a pro, I've just had some similar experiences!

It looks like the window may have been improperly installed and leaking water may have done more damage than you can see. The top of the frame outside appears to have just been caulk-sealed. Even a tiny crack in the seal will cause capillary action and suck the water into the joint. You need to put appropriate flashing over the top of the window as a bare minimum, but this may require you to remove the window first. This suddenly makes it a much bigger job but it could reveal rot in the framing which, while far more time consuming to deal with, is best taken care of now. If you do take the window out I recommend getting the advice of a local builder to prepare and reinstall it properly and according to local codes so that it's properly weathertight.

Here's a video of how to install a window into new framing.  While the process of retrofitting is made harder by the existing cladding, the principles are the same - make sure that there is a layered approach to drainage.

As for the interior it looks like some mold is forming, best to remove affected drywall, scrape anything else you can see back and treat the entire area first with mold treatment (pre-paint treatment, or ask your local hardware store what they recommend).

Once the flashing is in place and the all the mold you can see has been killed (there's probably more deeper but you can't really fix it without major intervention), it's best to let the framing and wall cavity dry completely: a few days to a week, depending on humidity. Most mold can't grow below certain humidity levels. In the meantime, check for further dampness and leaks before you go and cover it all up again.

Then yes, I'd get some new drywall or timber panel and tidy up the inside.  Good luck!