to go off/away with your tail between your legs means to retreat in disgrace/ to escape feeling ashamed of what you have done. As to the second part of the sentence, it depends on what he meant.
Probably he meant that he couldn’t understand this so he went away… and tried to do it in his own way. But I’m not sure here.