Whipping boys were usually high-born companions of minor noble houses whose families had high expectations and wanted them to rise through the ranks of nobility. Other times though, the boy could be a street urchin without family, or from a very poor background whose family could not afford to send him to school.
https://weird-history-facts.com/whipping-boy-court-companion-beatings/