In the name of God,
may His light shine on your path of finding truth and good.
When we intend to do something of good nature, something that will connect the soul to its true purpose of nearness to the Divine, the lowly parts of the Self and its influence by the whispers of evil fight to keep one away from what is good.
What you experience may be a result of that. That when we want to do good, we are influenced to keep away from what draws us towards His door.
Sometimes we are kept away from going somewhere or doing something which in its essence is good but done at the wrong time and during wrong conditions may push you away even further.
We are tested individually and customized to specific times of our lives. One must always check with oneself and find the reason to why one wants to do something. We may experience that we desire to pray, to study, to read, to give (and so on) and then we are redirected from those actions. Later in life we may come to the conclusion that if we had done that at the specific time, we would have done it with riya' (the intention of showing off or gaining worldly positions).
Imam Ali (peace be upon him) said
Perfecting an action is more difficult than performing the action itself, and purifying an intention from corruption is tougher for the striving ones than engaging in lengthy jihad. (Bihar al-Anwar, volume 77 page 288 no 1)
You must reflect and contemplate and you will find what is behind this redirection. When you know, and you will know by looking deep within. Look past where it hurts, where the reality of what we hide from ourselves lies. There you will find your reason and then you can change it.
If it is caused by the whispers of evil - find the strength to fight it and view yourself as victorious.
If it is caused by the harm of riya' - praise God that He kept you away from it, then fight it and humble yourself by going somewhere no one knows you.
If it is caused by poor planning - find the motivation to plan your day and keep to your schedule.
If it is caused by something else - find what is within the depths of your strength that God the All-Mighty has blessed you with.
That you seek answers, that you search and ask for help is a beautiful trait and a blessing from God. I am sure you will find the reason and the remedy even more efficient than the ones you ask, and ask God to assist you He will open doors of self-recognition for you.