A person or animal who is used as the subject of an experiment.
It isn't at all clear why these cute family pets came to be given their name. They are cavies, not pigs, and they don't originate from Guinea. Both 'guinea' and 'pig' seem to stem from simple, but mistaken, associations. The name 'guinea pig' dates from the 17th century and the first record of it (as 'ginny-pig') is in William Harvey's medical textbook Anatomical exercitations, concerning the generation of living creatures, 1653.
The 'guinea' part of the name is perplexing. It was certainly a reference to a place rather than to the idea that the animals cost a guinea to buy. The guinea coin was first struck in 1663 - after Harvey's publication. Guinea is in fact in East Africa but the little rodents, properly called Cavia Cobaya, are from the Andean region of South America. It could be that the name derives from the 'Guineamen', which were sailing ships that followed a route from the UK to Africa and then on to the Americas, plying the slave trade. It could also be that the distinction between West Africa and South America wasn't as clear as it is now. 'Guinea' may have just been a synonym for 'somewhere a long way across the sea'.
'Pig' is a little easier to understand. Cavies do at least look somewhat like tiny pigs and that was in the mind of the academics who first gave them a Latin name - Cavia porcellus, porcellus meaning 'little pig'. This is in line with the habit at the time of naming any small and vaguely porcine creatures as 'pigs'. George Gascoigne's translation of Noble Arte Venerie, 1575 does that for baby badgers:
"There are Foxes and theyr Cubbes, and Badgerdes and theyr Pigges."
The same loose associations were no doubt at work when the animal was called the Spanish Coney in a 1710 edition of The British Apollo: Containing Two Thousand Answers to Curious Questions in Arts and Sciences:
"A Guinea Pig... in Johnston's Natural History goes by the Name of a Spanish Coney."
Coney was the old name for rabbit so, instead of a pig from Guinea we have a rabbit from Spain.
The first use of the term 'guinea pig' to describe a person didn't have the current 'subject of an experiment' meaning, but was a name for inexperienced midshipmen on the sailing ships mentioned above, as recorded in The Adventures of a Kidnapped Orphan, 1747:
"He sent his nephew, at the age of fourteen, on a voyage as a Guinea-pig."
It wasn't until the 20th century that the expression was given its current meaning. This was first alluded to by George Bernard Shaw, in Quintessence of Ibsenism Now Completed, 1913:
"The... folly which sees in the child nothing more than the vivisector sees in a guinea pig: something to experiment on with a view to rearranging the world."
Shaw, who was a noted vegetarian and what would now be called an animal liberationist, was referring to the practice of using guinea pigs in scientific experiments. This had been going for some time by 1913. The celebrated French chemist Antoine Lavoisier used a guinea pig in an experiment on respiration in 1780.
Why guinea pigs were chosen as subjects of experimentation isn't entirely clear. They may not have cost the huge price of a guinea but, being imported from 'Guinea', they were more expensive than mice and rats, which have now largely, if doubtless reluctantly, taken their place.