The 18th-century reinterpretation of a psalm became the unlikely classic Christmas carol “Joy to the World.”