Beijing will impose export controls on two rare elements essential for manufacturing semiconductors, in apparent retaliation after the United States and Europe restricted chip exports to China.