Seriously! Why does shaving gel come out of the can as a gel but when rubbed, it foams!? What is it that causes this?
Because it’s formulated to do just that. Think of “soft soap” as compared to bar or powdered soap.
This site gives a full chemical breakdown and explanation of the ingredients in Gillette’s brand of shaing gel:
http://neon.chemistry.ox.ac.uk/course/ityeartwo/html2/GILLETTESHAVINGGEL.htm
My guess, based on the explanations, is that the Glycereth-26 and the PEG-150 distearate are what gives the product its gel properties while the Lauramide DEA causes the gel to foam when rubbed on the face (or wherever).