Post hoc fallacy

The post hoc fallacy means "after this, therefore because of this". Its Latin name is Post hoc ergo propter hoc. It is a logical fallacy. When event B happens after event A, a person might think "event A must have caused event B".
Example: 
It is a tempting error because sequence in time does sometimes suggest causality. When I press the light switch, the light comes on, and that is a cause and effect sequence. The difference is that it can be explained why the light comes on when the switch is pressed. On the other hand, no-one can explain why a rooster's crowing might affect the Sun.
Popular culture.
The phrase is used by the character Sheldon Cooper in the third season of The Big Bang Theory. Sheldon mentions the logical fallacy in disputing his mother's claim that her prayer group did ensure his safety during his North Pole expedition.