Obsessive-compulsive disorder (OCD) is characterized by unreasonable thoughts and fears (obsessions) that lead you to do repetitive behaviors (compulsions). It's also possible to have only obsessions or only compulsions and still have OCD.
With OCD, you may or may not realize that your obsessions aren't reasonable, and you may try to ignore them or stop them. But that only increases your distress and anxiety. Ultimately, you feel driven to perform compulsive acts in an effort to ease your stressful feelings.
OCD often centers around themes, such as a fear of getting contaminated by germs. To ease your contamination fears, you may compulsively wash your hands until they're sore and chapped. Despite efforts to ignore or get rid of bothersome thoughts, the thoughts or urges keep coming back. This leads to more ritualistic behavior — and a vicious cycle that's characteristic of OCD.