MassMutual has reached a deal to buy one of American Financial Group Inc.’s major business units for $3.5 billion.