Cookies are small files stored on your computer, typically they're used by websites to maintain your preferences, identify your session, store items in shopping carts etc. Some websites, especially shopping sites, will not work correctly if you disable cookies in your web browser. Cookies do not harm your computer, but they can potentially be used to track some of your browser activity.
If it's just those annoying ads that seem to know what you've been looking at that bother you, you may want to consider opting out using Ad Choices. Ironically, this service uses a cookie to store your opted-out status and will be lost if you clear your cookies.
Managing Cookies in popular browsers
How to change your cookie settings in Google Chrome
How to change your cookie settings in Firefox
Safari (OS X)
How to change your cookie settings in Safari (OS X)
How to change your cookie settings in Safari (iOS)
How to change your cookie settings in Android