It sounds like you are experiencing some very, very unpleasant and concerning symptoms. You should seek care with your primary care physician
right away to discuss these symptoms and appropriate evaluation. If you start having another of these episodes, you should call an ambulance for evaluation in the emergency department immediately.
It is impossible to say exactly what is causing these symptoms without completing a full history and examination and obtaining specific lab tests, but depending upon your age and other health issues, your symptoms could be consistent with a lack of blood flow to the brain, an event sometimes referred to as a TIA or transient ischemic attack. A TIA is often thought to be a precursor to a stroke, so it is important to identify this immediately to make sure that your don't suffer any further health problems. Some of the symptoms you describe could also be from a heart problem, specifically a problem with the conduction system in your heart. If your heart is beating too slowly, then you could experience the symptoms you describe. In patients with this kind a problem, a pacemaker can be required.
Overall, there are many conditions that could be causing your symptoms, and it is very important that you be evaluated immediately to ensure that you don't have a bad outcome with the next 'attack.' See a doctor