Unless he could be exhumed and tests done directly on his tissues, we shall never know for sure, but it seems to me very possible that he had a gene that gave him a predisposition to porphyria (and which was inherited by several of his descendants who displayed symptoms) but that the medication he was given for his earlier milder attacks contained arsenic and exacerbated his illness. The gentian-based digestive medicine which tinged his urine blue was administered because he was already suffering from the abdominal pain.
References -
In George 111's hair "An unexpectedly high concentration of arsenic (17 parts per million [ppm]), compatible with systemic toxicity, was also detected. Control hair samples had concentrations of arsenic between 0·05 ppm and 0·25 ppm (table). Values greater than 1 ppm in hair are thought to indicate possible arsenic poisoning."
"Although there is no established proof that arsenic alone provokes acute attacks, exposure to arsenic and lead in “moonshine” whisky has been reported to precipitate variegate porphyria12 and excretion of porphyrin metabolites correlates with the degree of chronic arsenic exposure in animals and man. If George III did indeed inherit the inborn error of metabolism that causes porphyria, he would be sensitised to the effects of arsenic and other heavy metals. Indeed, amounts of toxic metal insufficient to induce frank poisoning would, in all probability, exacerbate porphyric attacks in a susceptible individual." pdfs.semanticscholar.org/e71f/5dd29ba98b360969e5f4af6298417832ad10.pdf
"a single report of blue urine followed six reports of normal urine during the previous six weeks. Peters and Wilkinson suggest that the prescription of extract of gentian as a digestive stimulant three days earlier may offer an explanation for the discoloration. " It would explain that single report of blue urine, yes, but his physicians must have been aware of that likelihood and would have commented on the cause?
And
"Since heme is a pigment, it stains the urine. Usually the urine is tinged red or purple, but there are cases in which the urine turned blue, or left behind blue stains. " io9.gizmodo.com/the-king-who-peed-blue-930843334
"if George III had inherited porphyria, then half of his 15 offspring and eight siblings should also have had the porphyric gene." But it often descends "silently" only appearing on some trigger - and several descendants showed signs and symptoms (including the dark urine)