Welcome to Android Central! Any power-saving modes turned on? If so, that mode might be toggling off your Bluetooth automatically, and when you plug it in to charge, the power-saving mode turns off automatically, thereby turning Bluetooth back on. (I'm speculating here, because I don't have that exact phone.)