Roughly and in a nutshell, applying the two following rules will solve
many cases.
Rule 1: pronouns preceed the verb they are related to
---> je vois la maison: je la vois
---> je parle à mon frère: je lui parle
---> je veux parler à mon frère: je veux lui parler
[subrule 1: direct pronouns preceed indirect or circumstancial pronouns]
Rule 2: the "ne... pas" negation encloses the verb (or the combination
[pronoun(s) + verb]) onto which the negation applies
---> je vois la maison: je ne vois pas la maison: je ne la vois pas
---> je parle à mon frère: je lui parle: je ne lui parle pas
---> je veux parler à mon frère: je veux lui parler: je ne veux pas lui parler
So, in your example, you get:
---> je ne voulais pas y aller
Certainly more complicated cases exist, but the preceeding will help.