Google agreed to a record $391.5 million privacy settlement with a 40-state coalition of attorneys general Monday for charges that it misled users into thinking they had turned off location tracking in their account settings even as the company continued collecting that information.