Sometimes when I'm completely relaxed or resting, my heart rate will suddenly get extremely fast for several moments. What could this be?

Need evaluation. There are a number of conditions that could do that. I would see my doctor. You will need an EKG and labs and might have to use a device to monitor your heart to try and catch these episodes. Some don't need any treatment if the episode is short and some require treatment. See your doctor.