How to not feel bad for doing math? I have a MsC and want to take a PhD in algebraic topology. Probably very few people in the world will have any interest of my thesis.  They will pay me for doing my hobby. Its the only job I can think of which doesnt contribute to bettering the world somehow. I feel like I should get a real job like doctor or garbageman. I  get bad conscience. How can I feel better for pursuing my dream?

If you are going to take a "real" job as you say, without the will for it, you will feel even worse. This feeling may make you under perform and actually you can end up even contributing less to bettering the world as you expected, so your choice should always be what you really like. If you have an easy access to this PhD position I really recommend you going for it. Moreover, as hardmath pointed out you will be very useful by sharing your knowledge with students.
