It is not as though Jesus did not know the name of this demon, nor the number of demons that he represents. It is most likely that Jesus asks for the name, so that the disciples will learn the extent of this demon’s power, and thereby learn something of the much greater extent of Jesus’ power.
9 And Jesus asked him, “What is your name?” He replied, “My name is Legion, for we are many.”