How did J.J. Thomson know the electron was negative?
Ben Franklin discovered that electric currents were the result of movement of charged (positive and negative) particles, and he made those arbitrary assignments more than 100 years before Thompson's experiments.
At the time of Thompson's experiments, the polarity of batteries was well-established, if little understood. By freeing electrons from atoms in a cathode ray tube and observing the deflection of the beam when exposed to charged plates, Thompson was able to measure the mass-to-charge ratio of the electron. The sign of the charge, though, had been arbitrarily assigned by Franklin much earlier.