She told him to stay away from bad company.

Literal

She [topic-は] him [to-に] bad-friends [to-に] not-approach [in-order-to-ように] said.

悪友 ('bad friend, evil companion') is built from 悪 ('bad, evil') + 友 ('friend'). Common in moral or parental admonitions. The double に (彼に + 悪友に) marks both the recipient of the telling and the target not to approach — different uses of に in the same sentence. ~ように言う indirectly reports the directive.