A cookie is an electronic signature that a site can put on your computer so that it can identify you in the future.
In terms of affiliate marketing, when you click on an affiliate link, generally it will put a cookie on your computer so that if you follow the link and buy something, the merchant can connect your sale to the affiliate whose link you clicked.
Here's a more throrough explanation:
HTTP cookie - Wikipedia, the free encyclopedia