The brain is the most complex dynamical structure known within the universe. It is able to process massive amounts of information, develop responses and apply these responses for increased efficiency and mastery.
If we repeat behaviour often enough, it develops a self-organising dynamic that then drives the behaviour. Self-sustaining problematic behaviours are largely unconscious and may be as simple as obsolete coping strategies or as extreme as serious psychological and emotional conditions. Once established they influence the way we perceive the world, our relationship with it and our sense of self.