CPU overheating on Ubuntu 16.04 (MSI GE40)

Even though your room is not dusty, I would recommend that you clean your vent paths and fans in your Laptop at least once per year.

Sometimes the default /etc/thermald/thermal-conf.xml doesn't react soon enough. Save your original somewhere and try this one, noting that it has a ridiculously low threshold temperature, just for testing. Once you are satisfied that it solves your problem, raise the threshold temperature to something more reasonable, perhaps in steps:

<?xml version="1.0"?>

<!--
use "man thermal-conf.xml" for details
-->

<!-- BEGIN -->
<ThermalConfiguration>
        <Platform>
                <Name>Overide CPU default passive</Name>
                <ProductName>*</ProductName>
                <Preference>QUIET</Preference>
                <ThermalZones>
                        <ThermalZone>
                                <Type>cpu</Type>
                                <TripPoints>
                                        <TripPoint>
                                                <Temperature>55000</Temperature>
                                                <type>passive</type>
                                        </TripPoint>
                                </TripPoints>
                        </ThermalZone>
                </ThermalZones>
        </Platform>
</ThermalConfiguration>
<!-- END -->