If it's shutting off when getting hot this could be a bad crank sensor but both this issue and the rattling will have to be looked at by a technician. A hands-on inspection is needed to pinpoint the issue.
Use this link to find a good shop near you.
https://repairpal.com/repair-shops
Alex
RepairPal Certified shops can diagnose and repair your 1999 Chrysler 300M. They provide transparent pricing with a minimum 12-month or 12,000-mile warranty on repairs and services.