Both the UK and US (and probably other countries) have museums in their capitals called the "National Gallery". Are they galleries or museums? Does the distinction even make sense?
For other cases it can depend on the purpose of the building and the collection. If it's about the art itself it's a gallery, if it's about the artistic movement and its historicity it's a museum.
there is a distinction, thats why there are different words. outliers and exceptions not withstanding, since words and their meanings do not force their usage.