Rarely when I'm falling asleep I get scared, almost as if I'm having a panic attack and I can't stop crying. What can this be? Anxiety?

There could be. Many different reasons for this. Going to sleep may remind you of a time when you were traumatized in the past. It could remind you of things you have repressed and do not therefore remember. The unconscious works in mysterious ways. In therapy you could try to analyze the dreams and makes sense of them.
Anxiety/Panic Attack. Yes i may be related to underlying anxiety syndrome.You should consult your doctor or a psychiatrist to confirm that and get appropriate therapy/treatment.