You develop obsessive compulsive disorder (OCD) by how you think in response to triggers, and how you behave to maintain your OCD. So let's say you trigger is a dirty and messy house. This situation triggers an intrusive thought, where you start thinking "my house is filthy," and "I will not be able to cope," and "I need to clean." So these obsessions induces anxiety and the physical sensations of anxiety, which result from the adrenaline response. The anxiety then gives you the urge to act, so you are compelled to clean repeatedly, and this can take much of your time. So after cleaning for hours, you get temporary relief, until the next time when you have a dirty house again, and this repeats the above cycle.
With OCD, you have triggers, which induces obsessions, which leads to anxiety. The anxiety then compels you to act, and these compulsions give you temporary relief from anxiety, until the next time when you are exposed to your trigger again.
You are also more at risk to develop OCD if you have a family member who has this anxiety disorder.
Please click here for more information and help on OCD.