Those wings are called S-Foil
Historically, S-foils had been developed to address overheating issues on wing-based starfighters. Because of the proximity of engines and weapons systems to narrow wiring that fit inside the thin wings, an excess of heat could cause mechanical meltdowns that would be devastating to the capacity of the fighters to function.
also
They [X-wing] had two pairs of wing-like strike-foils, or S-foils, mounted at the rear of the craft on opposite sides. The foils on each side locked in place flush against each other; during combat, however, the foils were folded out to increase the spread coverage of the laser cannons mounted at the tips of the foils. This gave the craft its distinctive "X"-like appearance when viewed from the front or rear. The cannons on some earlier models could not be fired with the S-foils in locked position, perhaps as a safety feature. During hyperspace travel, the S-foils remained locked to conserve energy.
T-65 X-wing on starwars wikia.