We first see the term used to speak of a false god in Bamidbar / Numbers 22:41: "In the morning, Balak took Balaam, and brought him to the In the morning, Balak took Balaam, and brought him to the High Altars of Ba'al, where he could see [as far as] the outer edges of the [Israelite] people., where he could see the outer edges of the people."
Josephus, the Jewish priest and historian of 2000 years ago, wrote of a mountain by this name that was about 60 furlongs or five miles from the camp of the Israelites. (Antiquities of the Jews 4:6:4).
In Shoftim / Judges 3:7 we are told that the Israelites served אֶת־הַבְּעָלִ֖ים / et HaBa'alim / the Ba'al. אֶת / et is a preposition that serves as the marker of a definite direct object of a verb. The Hebrew preposition אֶת / et is used with a semantically definite direct object of a proper noun or personal pronoun, but not with indirect objects. English does not have this concept.
After the אֶת / et is מַקָּף makkaf which appears as a dash, and connects the words in the way a hyphen connects words in English.
Then we have the word בְּעָלִ֖ -- ba'al.
Next is the ים / im ending which can infer plurality, but only if the verb is also plural. If the verb and adjective are singular it infers majesty, or power...
So here we have the instance of the Israelites appearing to worship a false god named Ba'al.
Why would the name of a false god in the T'nach (bible) also be used to speak highly of some people, too?
The word בַּעַל / ba'al means master or lord. While it was used for a false god it is also used to speak of others including G-d. Consider that Saul's son was named Eshbaʿal ("The L-rd is Great").
The word simply means "master." So the Israelites of the northern kingdom worshiped a false god they called "master." The term is often found in Judaism -- including in the term you mentioned -- "baal teshuva" -- a master of returning (to G-d)...
The honorific Baal Shem Tov means ''Master of (the) Good Name.''