Allah (swt) created every single one of us as pure, decent, and with a sense of innocence about us. And then He ingrained within us the desire to protect that purity and innocence as we live our life journey towards Him (swt).
This religion that provides us a lifestyle that would protect and preserve that purity that is inside of us all.
That is why in the Quran and in the teachings of the prophet (pbuh), we find practical advice on what we can do to try to protect our purity and to safeguard our chastity.
When you try, Allah will open the door for you. As Allah says, whoever is mindful of Allah, He will make a way out for you.