My step son intentionally exposed himself in the bathroom at camp to other children. He was embarrassed when confronted. Why did he do this?

How old is he? How old is he? If persistent have him see an md.
Incomplete question. If he is about the same age as the other kids, and under 6-8, this might be considered innocent exploratory play. If, as I suspect, he is older than those kids by more than 2 years, it is more worrisome and suggests prior sexual activity/exploitation in some venue. He may be precocious or could have been a victim. Time for a consultation with your doc and referral for counseling.