Mostly because these were the languages of colonial powers which imposed them on their colonies. When the colonies became independent, sometimes the native languages had died out, sometimes there were so many native languages that it made sense to continue with the colonial language. There are six official languages used in the United Nations. It should be mentioned that Russian is spoken in many countries, typically those of the former Soviet Union, but they have not been made official, partly because of resentment on the part of the ex-republics. It is difficult to formalize a definition for a dialect.
Some linguists say a dialect is a language without official status.
This would seem to be true of the Chinese dialects, since speakers of one dialect do not understand those of another. Most linguists agree that each person speaks an individual idiolect . Anything in between a language and an idiolect would be a dialect . The linguistic situation in Europe may be instructive. They are all descendants of Latin.