Something good or bad happening to us is our Prarabdha. Prarabdha karma are the part of sanchita karma, a collection of past karmas, which are ready to be experienced through the present body (incarnation).
There can be no effect without cause. Our good or bad tastes or tendencies, whatever they may be, are all simulations of Samaskaras (impressions) accumulated in the past. Only those among them which find favorable circumstances manifest themselves and become active. The others remain stored up, waiting for a suitable occasion, and bear good or bad results at the opportune moment. Whatever we do is a mixture of good and evil, hence we reap fruits in which both happiness and misery are mingled. We term a thing good or bad accordingly as the one or the other predominates in it.
Based on ‘Towards The Goal Supreme’ by Swami Virajananda
Other reading material:
Relevant videos: Swami Tadaatmananda on karma,
Contributor: Jyoti Lulla
Location of this post (10i): why-did-something-bad-happen-to-me