Al Aksa mosque was built where it was built BECAUSE the site was the site of the Jewish Temple Mount - where Solomon and then Herod built the Jewish temples, which has always included the Western Wall.
Al Aksa mosque was built on the land of the historic Jewish temple as a demonstration of Islam’s dominance.
The connection to anything Mohammed did - at that site - was a fabrication, a contemporary fabrication invented at the time the mosque as built, used to justify, falsify, why the Mosque was built there.
If I recall correctly, Al Aqsa mosque was a Byzantine Church before the Muslims conquered Jerusalem.
The Muslims then converted the existing church to a Mosque.