Why do testicles descend?

Cold storage. It does seem odd to put something so precious and vulnerable dangling outside the body, but sperm storage and rapid sperm production are best and safest below body temperature. Reflexes raise and lower them to keep the temperature just right, including heating during sex for sperm activation. Pain - even at the thought of testicle injury - helps protect them out in the open.
Better when cooler. Testicles can't produce sperm well when they are at 98.6 like the rest of the body. By descending and staying in the scrotum, they stay cooler and can produce sperm.