The Japanese chemical company has agreed to sell its pharmaceutical business to Bain Capital for more than $3 billion, in a bid to focus on its key businesses.