"Have to" and "need to" are two different phrases that look similar in meaning but have quite a little difference between them. Starting from the words that make up the phrases, it can mean to possess, to own, to hold, to be related to, to be affected by. But when used together with to, that is "have to," it simply means must. On the other hand, considering the word need, it can refer to necessity, a requirement, or an obligation.
Also, the meanings for "needs" can also a stand-in for "need to." So when using these phrases in sentences, they can have a slight difference in meaning, though they are used most times interchangeably. Considering this sentence as an example, "I have to take my bath now." According to the meaning, it is a must you take that bath. But when you say "I need to take my bath now," it implies that there is something that has obliged you to do that.