Ramsay is unlocked by training Cooking via cooking food and brewing. Gaining this pet is based on the amount of experience awarded at once; the more experience granted per item made, the greater the chance of gaining this pet. The chance is not affected by experience boosters.
In his dialogue, he asks the player what he is, to which the player replies that they are an idiot sandwich. This is a reference to an episode of The Late Late Show with James Corden, where Chef Ramsay placed two pieces of bread either side of Julie Chen's head and asked her the same thing.