<Both funds have an average credit rating of B, so it's not as if JNK simply took more risk.>
You're missing the average maturity of the bonds each fund holds. Both have similar credit risk profiles, but have materially different interest rate risk.
JNK's Weighted Average Maturity - 7.39 years HYG's Weighted Average Maturity - 5.07 years
That's a pretty big difference. JNK's duration is greater than HYG's and is more sensitive to interest rate fluctuations. So, if you think yields of existing bonds will decline, JNK is probably the fund to invest in. If you think yields will increase but still want to be in the high yield space, HYG is the fund to own.
JNK is more sensitive to the business or credit cycle. If you are worried about a double-dip recession but still want to be in high yield corporate bonds, you should be in HYG instead of JNK -- that is due to the greater interest rate risk JNK has largely due to the fund owning longer maturity corporate bonds.