A cookie is the term given to describe a type of message that is given to web browser by a web server. For example if you visit Amazon using Firefox, Google Chrome, or Internet Explorer, or other browser, you will probably receive a cookie. The main purpose of a cookie is to identify users and possibly prepare customized web pages or to save site login information for you. When you enter a website using cookies, you may be asked to fill out a form providing personal information; like your name, e-mail address, and interests. This information is packaged into a cookie and sent to your web browser, which then stores the information for later use. The next time you go to the same web site, your browser will send the cookie to the web server. The message is sent back to the server each time the browser requests a page from the server. A web server has no memory, so the hosted web site you are visiting transfers a cookie file of the browser on your computer's hard disk so that the web site can remember who you are and your preferences. This message exchange allows the web server to use this information to present you with customized web pages. A common example is that of returning to a web site previously visited that will greet you with a “Hello John Doe” instead of just a generic “welcome”. Unless of course your name is not John Doe!
Cookies are made up of text only and cannot be executed so they are not viral in nature. But, they do provide some information that may be considered a breach of privacy by some, and not so much by others. For example, most web sites need statistics to see how many people are visiting their site, how long they stay, and which pages are most popular. But these usually do not have personal information. A program used by many sites is Statcounter, and another is Google Webstats. And, there are many kinds of cookies; tracking, persistent, third party, super cookies, and zombie.
Because the subject is quite extensive and cannot be adequately covered in detail here, I would suggest the article on Wikipedia here. This is a good start and you can follow up with cookie managemant on you particular browser. Cookie anyone?