The sentence "I have subscribed to Cooking magazine for many years." is punctuated correctly.
When you have a magazine, you only capitalize the official name of the magazine. In this case, the official name of the magazine is "Cooking." Therefore, magazine is not capitalized.