Macbook pro mid 2014 15" turns screen off when unplugged and starts fans at max power
If the screen is semi-black, it should change the brightness of the logo as well. Not sure how one is happening and the other is not.

Before you proceed, you might wanna take a backup of your data.

Do the below:


Reset NVRAM or PRAM on your Mac - https://support.apple.com/en-us/HT204063
How to reset the System Management Controller (SMC) on your Mac - https://support.apple.com/en-us/HT201295
Install Onyx and try to fix system issues - https://www.titanium-software.fr/en/onyx.html It's a powerful and reliable system maintenance app
If you are an advanced used, try live usb booting with Linux and see if the same problem happens. If it doesn't, then the problem is with macOS. You might need to format your mac. If it does, then you might have a hardware problem and should be handled in a different way.


Glad to be of help. Let me know how this goes.