I suggest you combine jogging with strength. You can jog for half an hour every day, and then do some strength training, such as push-ups (for chest muscles and arm strength), sit-ups (for abdominal muscles), pull-ups and so on. How much you do depends on your physical fitness. For example, you can do forty push-ups, you can do them twice, and you have to finish them in one breath every time. Increase the amount of exercise every once in a while (for example, once a week).
As for whether running 5000 meters will hurt your leg, I want to say that it mainly depends on whether your physical limit is enough for you to run 5000 meters. If you feel sore legs after running 5000 meters, or your hands and feet are weak, dizzy or even vomiting, it means that 5000 meters is the limit of your state at that time, which is likely to hurt your legs, but if you run every time,