according to work energy theorem energy neither be created nor be destroyed it can change its one form to another
the energy carrying by moving fan his wind energy as it rotate the The Blade of fan so wind energy is transferred into mechanical energy which further change its form to electrical energy buy The dynamo which is connected to the fan.