Goals are a desired result.
Habits are deeply ingrained practices that are formed with repetition, and may or may not help you achieve that desired result. Some habits might actually hinder progress.
The only way to know which habits to cultivate (or rely on) is to have a desired result in mind.
Setting goals is important, because it helps clarify what you should spend time on, including the cultivation of habits that will help you achieve the goal. I could invest a lot of myself into the formation of a new (good) habit, but it may not help me achieve my goal.
And goals can also be reached without the formation of habit.