I've worked on and repaired Macs for over 20 years and I don't recall any of our organization's Intel Macs ever powering off due to a thermal issue. The Intel Macs will throttle the CPU speed if the laptop's cooling system is unable to keep the temperatures below 100C. With the CPU at idle speeds it is extremely unlikely that the laptop can overheat.
Try running the Apple Diagnostics to see if any hardware issues are detected.
Try booting into Safe Mode to see if the laptop powers off like the normal boot mode. If Safe Mode does not have a problem, then you most likely have an issue with some third party software or possibly a GPU failure which is common with the 15" models (more so for the older models, but I would not discount the possibility for the 2014). To look for possible software issues, run EtreCheck and give it "Full Disk Access" so that the report contains more information which may contain more clues. Post the report here using the "Additional Text" icon which looks like a piece of paper.
If Safe Mode also has the problem, then I would run Disk Utility First Aid on the hidden Container. Within Disk Utility you may need to click "View" and select "Show All Devices" so that the hidden Container appears on the left pane of Disk Utility. Even if First Aid says everything is "Ok" click "Show Details" and scroll back through the report to see if any unfixed errors are listed. If there are any unfixed errors listed, then try running First Aid from Recovery Mode, otherwise you will need to erase the whole physical drive before restoring from a backup or clone (erasing the drive destroys all data on the SSD).