Cookies are text files that allow a website to record your visit. This means you can be recognised when you go to the site again. This can be particularly useful for sites that allow you to customise a page so it looks the same every time you visit.
The file can store your username if it's required by a site so that you don’t have to keep re-entering it. It can make repetitive tasks such as online shopping easier; as you only need to enter your details once and the site will remember it each time you visit.
Such information has also become useful for advertisers too as they can understand which products a user might be looking for based on the sites they have visited. This is how online advertisements can sometimes appear related to things you might be thinking of buying.
Cookies are not generally harmful to your computer but some have occasionally been known to be used by fraudsters, tracking your interests and viewing habits and building a profile of you.
To avoid this kind of risk, make sure you set your browser to warn you about whether a cookie is installed, and have the option to turn them on or off, on a site-by-site basis, according to those you trust.