"A photon appearing from nowhere"
The wording suggests to me that you're expecting some properties to be conserved, i.e. not changing over time. And indeed, many physical quantities are indeed conserved. A particle appearing from nowhere would definitely violate that. Let's look at a few of those conserved quantities: energy, impulse, electric charge.
A photon definitely has energy, but your gamma photon was created by a nuclear process. This literally is nuclear energy; the original atom nucleus had a higher energy than the resulting nucleus.
A photon also has impulse. Unlike energy, impulse is a vector. You'll see the resulting nucleus recoil after emitting a gamma photon - it gets an impulse change in the opposite direction. The total impulse is still conserved; the two impulses add up to exactly zero.
Finally, electric charge is the simplest of all: a photon simply has no electric charge, so this is yet another conserved quantity.
There are more conserved quantities, but in the end the conclusion is simple: a photon is just a particle with a few properties, and all those individual properties can be accounted for.