In that Sloka the word Vishnum
is in second case(dvitiya) implying Vishnu as the nama (actual undeclined noun). This name comes from the dhatu (verbal root) vish meaning all pervading. This attribute of all pervasiveness can only be truly applied to Vishnutattva. You will see in many places in Gita how Lord Krishna declares this all pervading nature of His.
One example is Gita 9.4:
By Me, in My unmanifested form, this entire universe is pervaded.
All beings are in Me, but I am not in them
While I do not know exactly why people attribute it to Lord Ganesha, long time ago I was under the impression that it was for Lord Ganesha for the same reason given by @jabahar. Lord Ganesha is generally worshiped before doing a religious activity in order to counteract any obstacles. Since this sloka has reference to the word vighna (obstacles) it is definitely a source of confusion to many. Ultimately Lord Ganesha gets his power to remove obstacles from Lord Krishna or Vishnu only.
Lord Krishna in Gita 7.22 states:
Endowed with such a faith, he endeavors to worship a particular demigod and obtains his desires.
But in actuality these benefits are bestowed by Me alone
In Brahma Samhita 5.50 Lord Brahma says.
yat-pada-pallava-yugam vinidhaya kumbha-
dvandve pranama-samaye sa ganadhirajah
vighnan vihantum alam asya jagat-trayasya
govindam adi-purusam tam aham bhajami
I adore the primeval Lord Govinda, whose lotus feet are always held by Ganesa
upon the pair of tumuli protruding from his elephant head in order to obtain power
for his function of destroying all the obstacles on the path of progress of the three worlds.
So, overall, the direct meaning refers only to Lord Vishnu and there is no need to go for indirect interpretations when the direct meaning is fully clear both from the nama (word Vishnu )and the attributes of all pervasiveness (Vish dhatu) and ultimate remover of obstacles (Vighnas).