I believe what you may be referring to are called 'intrusive thoughts'. Most humans have them. There are a number of 'calming' and 'grounding' techniques that are used to settle the mind and show yourself that while scary, these are only thoughts and can be worked through.
I use a lot of cognitive processing whenever this happens - while they seem to come out of the blue, when they happen I know I need to pay more attention to my own anxiety, make sure I am not HALT (hungry, angry, lonely, tired,) hormonal, sad, etc.
Sometimes the thoughts can come when things seem calm and when we have 'peace' for a few moments then, whack, intrusive thoughts. That is also when a lot of abuse happened in my life i.e., when things seemed calm, when I wasn't worried about anything and when there seemed to be quiet in the house. For a long time that peace, quiet and silence would initiate the intrusive thoughts. Intrusive thoughts were my way of telling myself my anxiety was rising simply because it was quiet in the house.
If you are seeing a therapist, let your therapist know and ask for some help with grounding techniques.