When you cook the eggs, the proteins present in the eggs start to react with the metal of the pan. Therefore, it is advised to use a nonstick pan, as the coating of the nonstick pan will not allow the proteins to form the bond. And this coating prevents the eggs from sticking to the pan.