SoftBank Group has agreed to lead a funding of up to $40 billion in a for-profit subsidiary of OpenAI, valuing the ChatGPT maker at $300 billion.