A company building a large petrochemical facility in Beaver County has agreed to settle a class action lawsuit over alleged overtime violations for $38.5 million.