I would check the fan relay(s). The Mass Air Flow Sensor will not have anything to do with this problem.
Also, check your radiator, the coolant level etc. Make sure that you don't have any coolant leaks.