According to research by Aviva, an insurance company, there are basically two reasons why people snack at work:
1) Need for energy: hunger or managing the mid morning or mid afternoon slump (39% due to hunger, 25% boost energy during mid-afternoon slump, mid-morning slump 18% and evening slump, 14%) or
2) To improve mood and make people feel better about themselves (22%).
While it is easy to study, when we snack, why we snack is more complicated. It involves, biological and psychological factors as described below, there are also cultural, and environmental factors that influence our choices and decisions (i). Big food companies understand this and cater to our needs along all the known factors (ii).
The need for energy is highly correlated to the level of insulin in the blood and (see explanation in the book) the more we consume simple sugars, the more we get into a pseudo-starvation mode. This is a powerful effect that causes us to look for immediate energy input, and sugar is the perfect option. This in turn initiates a cycle where the sugar leads to a peak in insulin and the next hunger pang. You may have heard the term "hangry" (hungry + angry), which happens when we are in starvation mode. Our system creates the aggression to go rummage or kill something. Fortunately (or not) in the modern world, we don't have to chase hours after a rabbit, but can just grab a snack that is mostly within reach.
It is difficult to resist these urges, especially when they combine with ritual and reward.
The one practical way to help your urges is to always, ALWAYS have a high-fiber snack nearby (for me it is always some roasted seeds, nuts, dried prunes, fresh fruit, carrots, but pick whatever whatever floats your boat). Fiber powerfully suppresses the vicious cycle described above and you don't have to give up on the reward.
(i) Note: For a review see Julie M Hess, Satya S Jonnalagadda, Joanne L Slavin, What Is a Snack, Why Do We Snack, and How Can We Choose Better Snacks? A Review of the Definitions of Snacking, Motivations to Snack, Contributions to Dietary Intake, and Recommendations for Improvement, Advances in Nutrition, Volume 7, Issue 3, May 2016, Pages 466–475
Scheer, F.A., Morris, C.J. and Shea, S.A. (2013), The internal circadian clock increases hunger and appetite in the evening independent of food intake and other behaviors. Obesity, 21: 421-423.
(ii) For a recent report, which also looks at snacking during the pandemic see: 2020_MDLZ_stateofsnacking_report_GLOBAL_EN.pdf (mondelezinternational.com)