It doesn't learn. The player drops cookies and the AI eats them, following the player. Eventually, after you've dropped enough cookies, the AI can then follow the cookies and do everything you do.
OM NOM NOM!!!
Learning AI! Yay!
OM NOM NOM!
Oh noes, pwned by the cookie monster!
Edit: Ninja'd by the apple man. The bots drop them too, nice to know.