Hanyu is name that the Han or Chinese people use to refer to the spoken language of the nation of China. Properly, however, it refers only to the language of the Han people, the ethnic group usually referred to as Chinese.
The spoken language of the Han Chinese was traditionally called "Zhongguoyu", the Chinese National Language, however, during the beginnings of Communist rule of China in the late 1940s or early 1950s, some lip service was paid to the Marxist doctrine of non-ethnocentrisim. Thus, the government wanted to make it seem like The Chinese nation was not the sole property of the Han ethnicity. Thus, they renamed the national language to the "Han language".
However, the written language and literature of China is still referred to as Zhongwen, "National Language".