Hello,
Its general thing that our Smartphones gets heated during use and we don't have any idea how. But when it gets overheated then its a serious issue which should be solved. However not only Samsung Galaxy S7 has the problem but almost all Android devices face the same issue. So one should take care of your device and tool some preventive measures like:
Stop apps from running on background
Battery drain
Heavy games
Android case
Software updates or app updates