What is a cookie? The quick answer
Cookies are little text files that your browser stores on behalf of different websites. The websites use these text files to differentiate your browser from all the other browsers in the world, and to customize themselves to fit your preferences. There are many types of cookies, but the most notorious type, the tracking cookie, allows websites to record your browsing habits.
Origin of cookies
Cookies were introduced in the first version of the Netscape browser in 1994 as a simple mechanism for web servers to identify users over short "sessions" of HTTP requests. Through a long standardization process lasting into the early 2000s, the benefits of cookies were weighed against potential abuse and privacy concerns. In the end, no truly satisfactory compromise were made between these two viewpoints, and we still live with the consequences of this today.