A cookie is small amount of data that is transferred to your browser by a web server and can only be read by the server that gave it to you. It functions as an identification tool, keeping track of logons, purchases, and preferences. It cannot be executed as code or deliver viruses.
Most browsers are initially set to accept cookies. You can set your browser to notify you when you receive a cookie, giving you the chance to decide whether to accept it or not (for some web pages that require an authorization, cookies are not optional. Users choosing not to accept cookies will probably not be able to access those pages).