The word Karma in Sanskrit translates as ‘action’. Your karma is determined by your actions and also by your reactions to stress. When thought, word and deed are virtuous, virtuous actions (karma) are returned to you. When you move in non-virtuous patterns, then the results can be less than savory.
To say that another way: when you freak out and do hurtful things, hurtful things happen. When you chill under stress and do nice things, the world is a much nicer place to live.