What is instant pudding mix used for in baking cookies?
Flour is basically a mix of gluten and starch (about 10% gluten to 90% starch for all purpose flour, the ratio varies for other types). Whenever a baked good asks for the addition of pure starch, it is made under the assumption that you have no easy access to low-gluten flour types. Its purpose is to reduce the gluten-to-starch ratio. 

Gluten makes dough tough and is also the substance which makes it hold together. With less gluten in your dough, your cookies will be less tough, have more of a tender texture. They will also crumble more easily. 

Instant pudding is an ingredient which is more common in some kitchens than pure starch, so it is used as a substitute. It usually has sweeteners and aromas in addition to cornstarch. It is less controllable than using pure starch and adding the best amount of sugar and the desired flavoring itself, so it trades quality for convenience. In my experience, recipes which call for instant pudding also cut corners in other respects, and are unlikely to be of high quality overall. So I prefer to not use them. If you want the low-gluten type cookies, choosing a recipe with cornstarch (or directly cake flour instead of a mix of AP flour and starch) will probably give better results.