Replace the wall charger. Really. The termination block is trash and I see blistering on the comm connector PCB to the left, there will undoubtedly be damage on the main PCB below the termination block.
This can be caused by an improperly terminated wire as mentioned above by others. It can also be caused by a surge or other problems. I would check your breaker for damage, probably replace it too, especially if it didn’t trip when the charger cooked itself. Check your 14-50 outlet connections and make sure everything looks good in there too.
Running a pigtail / dryer cable from your 14-50 outlet into your wall charger adds another point of potential failure — especially if your pigtail is long. But it can and does work just fine. I have my gen-1 HPWC on a pigtail plugged into a 14-50 outlet.
This is my current solution since my gen-1 UMC died last year and new UMCs were out of stock. I kept this setup and leave my new UMC in the trunk of the car with the adapters since I don’t like charging at 32A when this charges at 40A. Bought the wall charger when I bought the car, but never properly installed as intended since it turned out I needed a service and panel upgrade and a huge run for a new sub panel in the garage to do what I wanted. I already had a 14-50 in the garage, not in the most convenient place, but plenty usable so we’ve ran with it for the last 4 years.