Two cookies are used by Moodle:
The essential one is the session cookie, called MoodleSession. This cookie provides continuity and maintains your login from page to page. When you log out or close the browser this cookie is destroyed (in your browser and on the server).
The other cookie, called MoodleID, is purely for convenience, remembering your username within the browser. It is safe to refuse this cookie - which you can do by unticking the 'Remember Username' box, found underneath the 'Username' and 'Password' fields on the login page.
These cookies are not shared with other sites.