I found this on a website. It sounds plausible:
"This expression appears back as far as the 1600s. 'Fit' likely comes from medical convulsions, such as those from epilepsy.
In the past, people may have mistaken these physical ailments for mental problems. By around the year 1900, 'throw a fit' started to appear as a synonym."
"Pitch" can sometimes be used to replace "throw".