Molecular mimicry is the most important concept to understand when thinking about why diet and acne are so connected.
Normally our gut acts as a barrier between the food proteins of the outside world and the cells of the body.
However, when the gut becomes damaged (such as leaky gut aka intestinal permeability), certain molecules can pass the gut barrier and interact with the body's immune cells.
Depending on a number of factors this may not be a problem, but if your immune system reacts to a molecule that looks similar to proteins or enzymes in the body, then this can be a major issue.
Every time you eat this food, your immune system will make more inflammatory cells against this food, and you will have systemic inflammation. Your body will start attacking not only the molecule itself but also the proteins, enzymes, and cells of the body.
This leads to systemic autoimmunity, which can result in acne through other mechanisms.
However, it is more likely that acne is an example of a Type III Hypersensitivity, which I will explain in another post.