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?

Simple - you contribute to humankind according to your ability to do your job.  Your ability to do your job is fundamentally affected by your enthusiasm for your job.  It stands to reason that the people should be taking jobs doing things they want to do anyway, regardless of pay, perks, etc.
If you are making great contributions to algebraic topology, then that is what you should be doing.  The small number of people being interested in your field means that opportunities might be limited.  But if this is what you are determined to do, then you should be able to contribute.  (Of course, always have a Plan B.)
If you pursue the medical or the sanitation arts despite showing no interest in either, you will not be able to contribute all of which you are capable.  That robs all of us of your potential.  Worse, you might get depressed over your inability to pursue your dream.  Depression is expensive and does you no good.  Better that you strive to be an algebraic topologist, where your contributions will be great and your happiness unbounded.
Never feel guilty about doing what you want to do for a living.  It is a gift from a successful society.
