Why does my gas fireplace shutdown when fan starts up?
A gas fireplace has several temperature sensor settings.  

One is to turn on the fan.  When the firebox gets hot, the fan turns on to spread the heat through the room.

There's also an overheat safety setting.  When the firebox gets dangerously hot, the heater shuts down.  

It sounds to me like these two settings are too close together.  I'd call in a gas tech for a cleaning and servicing.  It doesn't cost much, and should be done from time to time.

It's likely not electrical, as the overheat protection will work even if the power goes out.