As well as the two spellings, the word gyp has two meanings. One is the ‘pain’ meaning given above, as used in the ‘giving me gyp/jip’.
The second is ‘to swindle or defraud’. This meaning of gyp originated in the USA in the late 1800s. It was probably derived from Gypsy or Egyptian as a racial slur.
To confuse matters more ‘gyp’ is also used in the USA as the name for a female dog, and that usage certainly does derive from Gypsy.
We are concerned here with the ‘pain’ meaning of gyp or jip, which is pretty much limited to the UK.
The expression ‘it’s giving me gyp’ first began to be used in the UK in the 1950s. Here’s an early use from the London newspaper The Sketch, June 1954:
My sciatica has been giving me gyp.
It seems likely that this ‘gyp’ or ‘jip’ pain meaning was formed out of an earlier phrase – ‘gyppy tummy’.
‘Gyppy’ or ‘Gippy’ began being used by the British in the 1890s when Lord Kitchener’s forces were occupying Egypt, as a derogatory slang term for a local Egyptian, .
Later, when UK forces returned to Egypt in WWII, ‘gippy tummy’ was coined. This was the Egyptian variant of the many phrases for chronic diarrhoea suffered by travellers to hot countries. These include Delhi belly, the Rangoon runs, the Aztec two-step and so on.
The earliest use I can find of this in print is actually from an American newspaper, although it refers to an Englishwoman who was travelling in Egypt. It’s from the Texas newspaper The Paris News, July 1939:
Coleman’s wife was unfortunate to contract “Gippy tummy,” as dysentery is called in Egypt.
So, the pain that is known as ‘gyp’ or ‘jip’ began its linguistic life in Egypt, probably doubled-up over a lavatory.