Before his call to Prophet Hood and during the early Years of Meccan period of his ministry, the Prophet - and his community with him - used to turn in prayer towards the Kabah. This was not prompted by any specific revelation, but was obviously due to the fact that Kabah - although it had in the meantime been filled with idols to which pre-Islamic Arabs paid homage - was always regarded as 1st temple ever dedicated to One God.
"Behold, the First Temple ever set up for mankind was indeed one at Bakkah (I.e Makkah) rich in Blessing, and a source of guidance to all the Worlds. (Quran 3:96)
Since he was aware of the sanctity of Jerusalem - the other Holy centre of unitarian faith - The Prophet prayed, as a rule, before the Southern Wall of the Kabah, towards the North, so as to face both Kabah and Jerusalem. So this should answer your concern of The Prophet worshiping One God facing Kabah but actually facing Jerusalem.
After the exodus to Madinah he continued to pray northwards, with only Jerusalem as his Qiblah (direction of prayer). About Sixteen months after his arrival in Madinah, however he received a revelation (Verses 142-150 of Surah Baqara i.e Chapter 2nd) which definitely established Kabah as the Qiblah of the followers of Quran. Now they turned their face towards Kabah while at Madinah.
This "abandonment" of Jerusalem, obviously displeased the Jews of Madinah, who must have felt gratified when they saw the Muslims praying towards their holy city and it is to them that the opening sentence of the passage refers i.e ... THE WEAK MINDED among people say.....
If one considers the matter from historical point of view, there had never been "change" in the Divine Commandments relating to the Qiblah (direction of Prayer): there had simply been no ordinance whatever in this respect before Verses 142-150 of Chapter 2ndwere revealed.
So Muhammad (saw) did not invent anything and was not doing anything against the Word of God in order to win the hearts of creation. He was 1st following what he thought was right, but once God decreed , then he followed what was decreed.
As the Verse above says... Say "God's is the East and West; He guides whom He wills on to a straight way...which means it is not about facing East or West, its about believing and obeying God, for the Muslims were commanded and they obeyed, and the Jews were commanded and they disobeyed even though the one who was calling towards the path of guidance, is mentioned clearly in their scriptures.