When your cream is shaken, all of the fat molecules from the cream begin to clump together. The more you shake, the more these fat molecules cling together, until a clump of butter is formed, leaving only the fat-free buttermilk behind.
The Science Behind Homemade Butter