I replaced the TCM in our 13 JKU last year as we were having shift issues when climbing hills after a gear and tire size swap. at the time I opted for a replacement TCM from RPM Extreme as they offer reprogram service where you send it in and they send it back, believe it was $300. It definitely improved the shifting. I am not sure if a replacement TCM requires VIN number programming or not, Interwebs mention some do some don't. With the NAG1 auto transmission the theory is that it will relearn what it needs from the PCM. There are some articles on the web that mention a couple of ways to force the TCM to learn, one involves turning the key on and off while pressing the accelerator in a certain pattern (If i remember correctly, with key off, push down on accelerator and hold to floor, turn key to on (do not start) keep holding accelerator down for 30 seconds, switch key off and gently release accelerator.) TCM should have read values from PCM. again not sure about VIN number. , or can be done with a scan tool such as J-Scan or something like HP Tuners which is what I did. I used HP Tuners to download a copy of both my PCM and TCM so that I can upload them to a replacement part if either one ever dies and not lose my custom tuning.
That being said the P-0501 DTC code typically indicates an issue with the vehicle speed sensor. I have seen this error come up when someone changes tire size or gearing without reprogramming the ecu as it then provides false information to the PCM that the computer uses to calculate the torque to be applied to the transmission and when to shift. I have not had to deal with a speed sensor error on the JKU, but have had issues on other jeeps, some are located on the transfer case output and can either go bad, or the wiring can get damaged or bad ground. With my Jeep Commander the speed sensor was inside the NAG-1 transmission and involved dropping the bottom of the transmission off and replacing a module at around $340 for the part. kind of a pia but can be done by home mechanic although much easier on a lift..lol
Does the Jeep still run and drive, what issues are you having other than the Malfunction light coming on? If you have replaced the TCM and the Jeep still starts and runs I would not think it was a mismatch of VIN or a programming error of the TCM, might want to do some more digging on the DTC code and potential causes before going further.