In many cases, when referring to a substance that is harmful, the words can be used interchangeably. The definitions provided in most dictionaries include senses that overlap quite a bit. For example, the OED provides these definitions for each as the primary sense:
Toxic: 1. Of the nature of a poison; poisonous.
Poisonous: 1. Containing, or of the nature of, poison; having the properties of a poison; venomous.
So there are many cases where either word could be used.
The factory produced toxic gasses that were released into the atmosphere
means essentially the same thing as
The factory produced poisonous gasses that were released into the atmosphere.
In both cases, the implication is that the gasses could cause harm to humans or the environment.
But as with many synonyms, there are alternate senses for each word that don't work interchangeably, and slight variations in the way the words are used that make them subtly different.
For instance, consider "poisonous" used to mean "venomous."
Some snake bites are from nonpoisonous snakes, but 20-30% of the bites from poisonous snakes do not actually inject poison into the wound
One would not usually refer to a venomous organism as "toxic," but the word "poisonous" is used to mean venomous enough that it is included in the first sense of the word as defined in OED.
On the other hand, there are cases where the word "toxic" is used in extended figurative uses that would not be interchangeable with "poisonous."
Mike Cagney, chief executive of SoFi, was accused of contributing to a toxic workplace culture.
Here, "toxic" is being figuratively extended to mean that the workplace culture grew damaging and harmful to people involved, though not literally "poisonous."