This is a key concept of Bene Gesserit teaching, that a true 'human' is a person capable of identifying a course of action that benefits other humans, even at the cost of their own happiness. By comparison, 'animals' (a category in which they include other less evolved humans) will act to support their own personal survival even if the long-term consequences are undesirable.
Paul sensed his own tensions, decided to practice one of the mind-body lessons his mother had taught him. Three quick breaths triggered the responses: he fell into the floating awareness … focusing the consciousness … aortal dilation … avoiding the unfocused mechanism of consciousness … to be conscious by choice … blood enriched and swift-flooding the overload regions … one does not obtain food-safety-freedom by instinct alone … animal consciousness does not extend beyond the given moment nor into the idea that its victims may become extinct … the animal destroys and does not produce … animal pleasures remain close to sensation levels and avoid the perceptual … the human requires a background grid through which to see his universe … focused consciousness by choice, this forms your grid … bodily integrity follows nerve-blood flow according to the deepest awareness of cell needs … all things/cells/beings are impermanent … strive for flow-permanence within….
The Bene Gesserit use the pain box (in combination with the Gom Jabbar) to determine whether the person being tested can resist their animal urge to remove their hand, even if they've been told that the consequence is their death a short time afterwards.
“Good,” she said. “You pass the first test. Now, here’s the way of the
rest of it: If you withdraw your hand from the box you die. This is
the only rule. Keep your hand in the box and live. Withdraw it and
die.”
This, presumably, is how the Bene Gesserit identified which humans to focus their breeding plans onto. By identifying the most 'human' humans alive at the time, they were able to breed those individuals together to get an even more 'human' human.