The essence of Buddhism is understanding that we can't control our body, our mind and things happening around us. But people tends to involve those things and thus, our emotion attached to those things and start karma cycle.
For example, when we eat a food, at the same time in our mind happening Greed(on our favorite food), Anger (Bad taste, Don't like), etc. And based on those emotional attachment, we taking out the actions which will become karma and reincarnation cycle.
In Accent of Buddhism is eating also a part of life and that is out of our control and so get rid from attached mind such as Greed and Anger, etc., to stop reincarnation cycle.
So, it is natural that you have those kind of mind such as sexual thoughts. And try to understand as it as just a thought and watch as it is until it lose again, as everything as happening in this universe.