Learning the language per se isn't the best idea. You'll have to study the writing system properly through lessons and textbooks if you want to actually get a grasp of it. Writing, grammar, basic vocabulary - that should be acquired only via proper study, not anime. You won't be able to capture much from anime anyways aside from some cliche phrases like "doshtano" or "kimochiii".
What anime IS good for, is for training listening comprehension and pronunciation once you got the basics. It's a giant pool of perfectly valid audio exercise, don't listen to this guy.>>216926760
So learn the basics first, through proper learning methods. Use anime as a practise playground but not as an actual source of education.