Post hoc, ergo propter hoc, Latin for "after this, therefore because of this," a logical fallacy.

"My father had cancer. I prayed to God to let him live. The cancer went away. Therefore, my prayer worked."

"The Soviet Union collapsed after instituting state atheism. Therefore, we must avoid state atheism for the same reasons."
(borrowed from
If I wake up in the morning, and outside the sun rises, it doesn't mean that the sun rose because I woke up.