Good question. Might do better in a dedicated science community though. Also might just get answered with links to textbooks, since the actual explanation, to get to full understanding, is probably at least a years worth course of study that cannot be easily summarized. It likely involves a whole bunch of different individual chemical interactions, starting with “how proteins make structures”.