Subaru said it will end production of its oldest U.S.-built model, the Legacy sedan, after the 2025 model year, citing a shift in consumer preferences away from cars to crossovers and SUVs.