Apollo's question to Achilles is essentially a taunt designed to remind Achilles that he is not only fighting the Trojans but also the gods, some of whom are supporting the Greeks, and some, including Apollo, support the Trojans. The point is that when the gods intervene, mortals are helpless against them. In this case, however, Apollo has acted against Achilles also because Achilles is about to enter Troy itself, and it is not Troy's appointed time to fall:
. . . Apollo entered the sacred city,/concerned that the Argives [Greeks] would break through the walls that day/and lay waste to Troy before its appointed time. (XXI:482-84)
Even the gods understand that the Fates control the lives of men and kingdoms, and Achilles' (and the Greeks') routing of the Trojans, forcing them back towards the citadel of Troy, threatens Troy's existence. Achilles and his troops are at the Scaean Gates and are about to force their way in to pursue the Trojans. The Fates have already determined, however, that Troy cannot fall at this time.
At the end of Book XXI, in order to distract Achilles, first, Apollo inspires a great Trojan warrior, Agenor, to make an attempt to stop, or at least slow down, Achilles' progress towards Troy. Of course, Agenor has no hope to defeat Achilles, but he can distract Achilles for awhile. Second, after Agenor throws his spear at Achilles, which hits Achilles in his lower leg but bounces off his armor, Apollo begins the trickery designed to prevent Achilles from entering Troy:
Then in his turn Achilles charged at Agenor,/but Apollo did not allow him the triumph: he snatched/Agenor away and covered him in dense mist. . . . (XXI: 554-56)
Apollo's use of Agenor is a typical ploy at this point in the Iliad when several of the gods are actively intervening on behalf of either the Greeks or Trojans (the Theomachia). The saving of Agenor is secondary to preventing Achilles' progress.
After Apollo saves Agenor by spiriting him back into Troy's citadel, Apollo takes Agenor's form in order to trick Achilles into chasing him over the battlefield. The chase allows the surviving Trojans to get into the citadel and, finally, Apollo turns to Achilles and asks him why he has been chasing a god: "Never/ will you catch me since you are a mortal and I am a god" (XXII:8-10). As soon as Achilles recognizes that he has not been chasing Agenor and, more important, has allowed the Trojans to escape, Apollo chastises him with the taunt in your question, which, as I indicated above, is really meant to confirm the gods' supremacy over mortals and their wars.