Cookies are obtain by playing online. You receive an amount of cookies depending on your finishing position. There are also bonus cookies. Those cookies are given to the player who obtain a "title" like "most rolled", ...
You'll obtain at least 1000 cookies by going for the 50 matches achievement (just play):
If you want the cookies faster, you can boost this with friends. No one rolls up anything and you'll all receive the maximum amount of cookies because you all won. The bonus cookies will be given to a random player because no one did something to obtain a "title", so the game gives them randomly then.
Caution: There no autosave in the game. SAVE YOUR GAME after an online session. Also if you loose connection, your cookies are lost.