Acne occurs when pores are clogged by oil and dead skin cells. This causes the Propionibacterium acnes bacteria to grow. Your body reacts by sending white blood cells to attack, and the resulting inflammation is what we see as acne.
Now, coconut oil contains medium-chain fatty acids which can kill bacteria. One of these acids, the lauric acid, has been shown to kill the P. acnes bacteria. When coconut oil is applied directly to the skin, lauric acid can inhibit bacteria that commonly causes acne.
The science behind coconut oil and its role in fighting acne is still relatively new compared to studies of the role of the 2 most common acne-fighting ingredients: salicylic acid and benzoyl peroxide. If you are relatively new to acne treatments, I recommend trying products that contain these well studied ingredients first. The Drunk Elephant Babyfacial Mask is very good because it contains salicylic acid as well as other acids such as glycolic acid which also has exfoliating properties.