Be careful not to get caught up in trouble.

Literal

Trouble [in-に] become-entangled-not [so-that-よう] be-careful-[command-なさい].

巻き込む ('to roll up in, to drag into') is a compound verb (巻く 'roll' + 込む 'into'), and in its passive 巻き込まれる it means 'to be dragged into, to get mixed up in.' ~ないよう is the negative version of ~ように (abbreviated from ~ないように), a purpose/instruction frame. Together: 'act so as not to X.' The ~なさい command rounds it off as parental advice.