Where did the phrase like a guinea pig come from?

if you mean you'll be my guinea pig it means to use them as a test subject like for something never tested before or something dangerous