A cookie, in the context of web browsing, is a small text file that a web site may store on your computer. The vast majority of cookies are not harmful. A few web sites may try to use cookies for nefarious purposes, but those sites are usually clearly dubious and most are flagged as suspicious in Google search results, so you should avoid them anyway. Most advertising networks use cookies to try to keep track of the web sites you visit, but unless you're really paranoid, this shouldn't be a big concern.
Cookies get around a major limitation of the World Wide Web and web browsing: each time a web page is loaded, the web site forgets everything that came before and starts from scratch. For instance, if a web site developer wants to keep track of the number of times you've visited, they can store your visit count in a cookie. Without the cookie, the count would be lost and every visit would be counted as your first.
A web site's cookies may contain just about anything. They are commonly used to remember your username on sites that require login.
The Thousand-Sided Dice uses a cookie to keep track of your 'session' identifier, which is a big long number called PHPSESSID. The session identifier allows the site to remember your session data, which includes stuff like the current prefix and suffix, and the 'naughty fragment' setting. If cookies are disabled, this web site resorts to passing the session ID in the URL. Go back to the main page and watch the address bar as you use the dice. If your browser has cookies disabled, you should see something that looks like 'PHPSESSID=reallylongstringofstuff'. Ugly, isn't it? You can get rid of that by enabling cookies.