Why 0 or 1 for labeling categorical data?

machine_learning
feature_engineering
python
sklearn
label

#1

I was trying KMeans for clustering problem.I have a Gender feature and it also has nan’s.
So I forgot to take care of the nan values and used label encoder and got values like 1029 for male 1028 for female and with this data I got a silhouette_score of about 0.95!
Later when I realised this and corrected it to 1 and 0 the silhouette_score dropped to 0.70!

Both the times I used the RobustScaler to scale the data.

What could have happend here?