This is not a settings issue. The contacts inside the headphone jack are shorted out, which tells the phones a set of headphones is connected.
This can happen due to a tiny drop of water, humitity, a sliver of aluminum foil, etc.
The easiest way to clear and fix this issue is to blast a bit of...