@Nobody beat me to the way of thinking, but I have some additional things to say.
I don't want to do what she says.
That is a personal choice. However do not base your decision only on your feelings, that might hurt you later.
It's an expensive city, so an apartment close to work could easily cost me a third of my after-tax salary.
Talk to them and tell them that you are not willing to spend extra XX5 of your salary on accommodation. Ask why it is important to them that you live alone with a different life style. Maybe they have some good reason for that.
Additionally, be ready to discuss with them about a salary increase as a result of living in a very expensive area (compared to your current condition).
Having lunch at the canteen is over 10 Euro a day, and, also, I really prefer to eat alone.
If you mention the money thing here, you look "cheap" (i.e., bad). You still need to keep your dignity and show yourself as a professional.
And I equally prefer wearing comfy clothes I am used to.
Your comfy clothes might be other people's horror. Remember about the mechanic who is comfortable with his clothes also, but everyone else is horrified at looking at the hair between his butt-cheeks. I am sure you are not like the mechanic, but the local culture (e.g., the company culture) might require some different approach.
I would suggest here to have some "negotiation" with them, in order to find out which kind of clothes are "smart casual attire" enough for them, and also comfortable enough for you. I am quite sure that a compromise can be reached.
I don't think they will fire me or refuse to renew my contract over this
I would not bet even two cents with holes in them about this. Companies can do very unexpected stuff sometimes. Usually they ha an "open doors" policy. You are welcome to join, and you are free to go. Also, they also practice the mantra "nobody is irreplaceable", it is just a matter of time and cost.
or at least that would be highly irrational.
You had a really happy life until now, didn't you? You did not have to live the irrational yet... I envy you for this.
I have unique skills needed by them, and I also work long hours out of my passion about my research.
Read again what I wrote above. Everyone is just a matter of time and money.
I am highly insensitive to living conditions. I grew up in a family with many kids in poor living conditions and later shared a dormitory room with a few students for years. I've never rented a separate unit and absolutely don't feel any need to. Not only do I gladly live in a shared flat, but I also gladly share my room with a roommate to split the cost.
It is OK to share the money issue with them, as a basis for a salary increase, in exchange for changing your lifestyle.
However, if the company expect that you sometimes accept the visits of some important business partners (colleagues, bosses, customers), then your lifestyle is directly hurting the business. As I said above, ask them about their reasons.
Also, I find local trains and buses very comfortable and use commuting time to think about various things.
That is fine to share with them. I also prefer the public transport for the opportunity to relax and "meditate". It gives me the opportunity to see people, get the feeling of the neighborhood... You can be social without being social, in this way.
I come from a poor country
They do not give a rusted coin on that info. Better to keep it to yourself, and not hurt your well-being there.
and work in Germany to save up as much as possible, hence this lifestyle - and I am fully comfortable with it.
It is not important that you save - again, it might hurt your chances if you look cheap. It is important that you do not want to waste. You apply in your life the same principles you apply for the job - avoid unnecessary waste. If a new lifestyle brings you no benefit, then the spent money is pure waste.
Also, you skip the group lunch at the canteen every day, opting to microwave food brought from home, You surely can afford eating at the canteen with us and buying smart casual attire. We want other group members and visitors to respect you rather than think you are underpaid by us or there's something wrong with you. This is important for healthy work relationships.
Not socializing can be seen as aggressive behavior sometime. It give the impression of superiority. If you are really superior to others, then it is even more offensive. People hate to admit that they are not the smartest. You probably remember the squirrel in "The Hedge": "But what, am I stupid?" Obviously, he was, and everyone knew it, but saying the truth out loud was hated by everyone, even if hiding the truth was hurting them.
On one hand, you can play the card with "I prefer to keep my flow state during lunch, in order to keep my productivity in the afternoon". But you can also join your colleagues during lunch. They eat the canteen food, you eat the microwaved food. After all, you have no problem being with people, if you enjoy living in a crowded place.
... and wear clothes that are more suitable for wearing at home.... and (you can afford) buying smart casual attire. We want other group members and visitors to respect you rather than think you are underpaid by us or there's something wrong with you. This is important for healthy work relationships.
Well, this is the message that you hurt the image of the company. If you do not want to comply 100%, at least negotiate some percent higher than 0%. This can be the beginning of the end for you there. I am sure that you were not born wearing jeans (we are all born naked after all), and I am also sure that other kinds of pants will not give you unbearable rashes. My best advice: find a common ground, it should not be that difficult, and it cannot be that expensive. You do not need to buy the most expensive, just buy something that solves the problem.