Hello! I checked some information. Article 22 of the "Marriage Law" stipulates that "children can take their father's surname or their mother's surname." "Note: The legal terminology is "can" rather than "should". In legal terms, "can" means you can do it or not. (Can "can" be understood this way?) "Then, "children can take their father's surname or their mother's surname" does not rule out taking other people's surnames, and they can even choose another surname of their own. Therefore, it is perfectly fine for children to take their grandfather’s surname.
But in real life, in addition to taking the single surname of the father or mother, there are also many children who take the double surname of their parents. According to the principle of "no prohibition if there is no explicit law", as long as the parents agree, the surname of the children can be decided according to their own wishes, which means that the children can take the surname of their grandfather.