As someone whose second language is Chinese, I think 식 is similar to the Chinese word '食' (pronounced as 'shi', which means food) because to me, 식당 sounds like 食堂 (pronounced as 'shi tang', which literally translates to food hall). So I think the word 식 is related to food
I noticed both words you mentioned are related to 음식 which means food.
Looks like 식 comes from 食, which means food and is pronounced very similarly.
Food related things. Just like the 학 in 학생 and 학교 means school related things. It also probably means other things on its own.