A very good question. First of all, only a piece of the hamstring tendon is removed. At least half or more of the tendon is left intact. The postharvest strength of the graft tendon must be strong enough for early rehab and daily activities.
If the graft doesn't hold it usually pulls away from the bone with a little piece of bone attached. This is called bone avulsion.
Before these grafts were ever used on patients, scientists used animal and cadaver studies to test the strength of the tendons before and after grafting. This is how they know which tendons will hold up after a piece is removed for use as a graft.
They also found that ACL tensile strength decreased over 50 percent between age 20 and 50. This isn't true of the patellar tendon. During this same time period, tensile strength of the patellar tendon doesn't change. That makes the patellar tendon a good graft choice.