Citigroup said on Wednesday that it had agreed to pay $590 million to settle a class action lawsuit brought by shareholders who contended that they had been misled about the bank’s exposure to subprime mortgage debt on the eve of the financial crisis.