The WNBA star Brittney Griner, who had been detained in Russia for months on drug-related charges, was freed on Thursday as part of a prisoner swap for international arms dealer Viktor Bout, putting an end to the ordeal that had sparked protracted, high-level talks between the United States and the Kremlin to secure her release.