SoftBank Group Corp. said it agreed to take a majority stake in WeWork after securing a deal that could hand co-founder Adam Neumann a nearly $1.7 billion windfall and sever most of his ties with the troubled office-space startup.

WeWork, in danger of running out of cash in the coming weeks, chose a rescue offer from SoftBank over a competing proposal from JPMorgan Chase & Co., according to people familiar with the matter. It had asked both parties to submit proposals by a deadline Monday.

The...