Hi, I'd like to help you with your question.
No I do not believe that guilt over your activities with other girls outside of your relationship can cause you to become homosexual. What you are feeling is related to your OCD and is not related to your sexual orientation, or it is simply about your feelings of guilt.
Have you seen a therapist who diagnosed you with OCD? You may want to see a therapist for an evaluation if you have not seen one already. Sometimes our thoughts can be distressing, especially when it comes to feelings like guilt, but if you feel there is more to your symptoms than just bad thoughts, then a therapist can help you work with how you feel and help you develop better ways to cope. You also can consider medication if needed.
Please let me know if you have any more questions.
I hope this has helped you,
No, it is not possible to have a sudden chemical imbalance that makes you change your sexual orientation. Chemical imbalances often cause other symptoms in your body that are physical in nature. Scientists suspect that chemical imbalances are also involved in causing mental illnesses such as schizophrenia and bipolar disorders. If you feel you may have a chemical imbalance, you can always be seen by an endocrinologist for a full work up.
Unwanted thoughts such as yours can be a symptom of OCD. They can also be a symptom of anxiety. If you chose to see a therapist, they can help you rule out these disorders.
I understand your anxiety about your thoughts and dreams. But the fact that they are making you anxious says that they are not welcome thoughts and therefore not about who you are but more about your anxiety or OCD.
If these thoughts are disrupting your daily life, it would be a good idea to see a therapist sooner than later. You could also start working on this problem yourself by reading about your problem. Some good books to start with are Overcoming Obsessive Thoughts: How to Gain Control of Your OCD by Christine, Ph.D. Purdon and David A. Clark and Brain Lock: Free Yourself from Obsessive-Compulsive Behavior by Jeffrey M. Schwartz and Beverly Beyette. You can find these on Amazon.com or your local library may have them available.