I think that's a question that a lot of PDs are asking and there is some interesting research on the topic:
Status of Resident Attrition From Surgical Residency in the Past, Present, and Future Outlook. - PubMed - NCBI (Shweikeh et al Status of resident attrition... J Surg Educ 2018) and
Prevalence and Causes of Attrition Among Surgical Residents: A Systematic Review and Meta-analysis. - PubMed - NCBI (Khoushhal et al Prevalence and causes of attrition among surgical residents, JAMA Surg 2017) are some papers I've read, and the Khoushhal piece caused some controversy I think with their sex-specific findings.
I think a lot of it is program specific, person specific, and some things endemic to general surgery.
Program wise: there are definitely malignant programs out there, where the surgery residents are used as manpower with a strict hierarchy and varying levels of operating and autonomy. Overall I think this is improved from what I have heard about 25 years ago though.
Person wise, I think that general surgery has a broader pull of applicants of varying strengths than the subspecialties have and it is probably more likely that a person may get into general surgery as a 'back up' than those going into the subspecialties. This probably increases likelihood of 'jumping ship' if things don't go as planned (although with marginal candidates could also be somewhat protective if just from the sense of just wanting to be a practicing physician and not thinking one could switch fields). There are probably broadly speaking lower entry requirements to general surgery than the subspecialties; there may be more of a sunk cost fallacy to the subspecialties. Those in the subspecialties may have a firmer grasp of their end-goal practice pattern; some people choose general surgery because they are relatively undifferentiated and just think "Hey, I like surgery" without really considering the specific patient populations and daily workload of general surgery. General surgery also tends to have fewer requirements for aways, sub-Is, etc; it may be that medical students are not getting a realistic view of the workload of general surgery (whereas from what I have seen for ortho, they work those AIs harder than interns).
General surgery wise, I also think it may not live up to expectations. There is a lot of not-operating. I mean, think of all the little old lady falls with unilateral superior pubic ramus fractures with severe pain who can't ambulate that ortho doesn't admit but trauma does because she needs her three midnights for placement...General surgery also can have a high census of patients with medical disasters which is mentally draining and resource draining. There may also be a discrepancy in desired and perceived clout/reputation/respect from the other specialties/other people .