They are giant soulless transnational corporations that have little to do with Switzerland besides the fact that due to some historical curiosities they happen to have their headquarters here. Nestle makes only 2% sales in Switzerland.
Transocean which was not long ago one of top 10 SMI components is an american company, which literally moved its headquarter to Switzerland just for tax reasons and has nothing but a nominal HQ here. Are these tax dodgers the kind of thing you want to invest your money in??
You want to make a difference to the local community with your money? Buy products from local farmers and KMUs, stop shopping in Germany, donate to local charities etc.
Even if SMI companies were tighter connected to Switzerland, investing in their stock will have highly indirect, almost negligible, effect on the swiss economy. They are not some pre-IPO startups and don’t actually get your money directly to do something useful with it. You’re merely giving your money to other people who invested in Nestle et al in the past. Some of these people are current Nestle et al employees/managers/directors, probably many are swiss residents like you, so hopefully they’ll spend a part of your money here in Switzerland which would move the economy a lil bit, and that’s about the only connection your SMI stock investment will have with swiss economy. Buying local products, especially from small local manufacturers, on the other hand has a much higher direct economical effect - it contributes directly to GDP, they’ll pay taxes on your money, spend it locally on some another local things (food, rent, etc) which will move GDP further, etc.