Guilty feelings can be healthy or unhealthy.
They are healthy if they help you take some corrective action when you feel guilty. They are unhelpful if they just weaken you by making you feel bad about yourself.
Guilty feelings may be deserved or undeserved. If you have done something which hurts someone else, it is natural to feel guilty about it. Natures purpose for guilt is to motivate us to take responsibility for what we have done and do something to help the person we have hurt.
At times other people want us to feel guilty for some motivation they have, such as to control or maniulate us. When do this to us it is called laying a guilt trip on us. Guilt trips are always unhealthy because they weaken us and kill or lower our motivation.
When you feel guilty, you are at war with yourself. You have violated some internal standard. This is a good time to examine your standards, apologize, ask for forgiveness, make restitution, learn from the experience, and learn to forgive yourself.
Here are some helpful steps as guidelines for what to do when you feel guilty
Evaluate your standards - Ask yourself if the standards you are comparing your actions against are really your standards. In other words, did you consciously select them, or did you adopt them without careful consideration?
Apologize - If you have done something involving another person which you feel bad about, apologize by expressing your honest feelings. Ask the injured party how she felt about what you did, then listen without defending yourself. When the injured party has fully expressed herself, you will have learned a great deal, and she will feel much better.
Restitution - If possible and practical, offer to make restitution, by asking what you can do to make it up to her. By these actions you are showing that her feelings matter to you, and that she matters to you. Finally, ask if you have been forgiven. When you have apologized, made restitution, and been forgiven, you will feel much better because you have closure.
Forgive Yourself - There is a chance that the other person will not accept your apology. They may say something like: "There is nothing you can do! I never want to talk to you again!" When someone denies you the opportunity to apologize, they are attempting to punish you. This may help them feel better in some sense by helping them feel self-righteous and superior to you.
If you do feel punished as a result, it is up to you to forgive yourself.
On the other hand, it is possible that someone else might forgive you, but you still feel guilty. In this case it would be healtier for you to forgive yourself once you have apologized and made restitution as best you can.
Learn - Sometimes there is no one to apologize to, no one to make amends to, and no way to make restitution. In such cases, truly learning from the experience will help lower your feelings of guilt. Of course, truly learning means applying what you have learned in order to change your behavior. It doesn't mean just saying "Well, I guess I shouldn't have done that," and then doing it again later. Truly learning also means accepting your faults and accept yourself, while still growing and developing from your experiences.