That thermocouple is a thin copper rod next to the pilot flame. When it gets covered in soot or dust, it stops sensing heat. The fireplace panics and shuts off the gas.
The fix is hilariously low-tech. Take a piece of fine steel wool or an old toothbrush and gently scrub the tip of the thermocouple. Just a few passes. You’re not trying to polish it, just remove the carbon crust.
Try relighting the pilot again. More often than not, this simple scrape is the magic trick. I once fixed a $150 service call issue with a toothbrush I found under the sink. Irony is real.
Gas Fireplace Won’t Turn On – Solved! - YouTube