1. Use of the Hebrew word satan
The Hebrew word satan means, in a general sense, 'opponent', 'adversary', or 'accuser'. As with any word in any language, satan does not have a one-size-fits-all application. It can mean different things in different contexts.
In my answer on this question, I surveyed a few of the Hebrew texts that use the word satan. On one occasion we find the word used for David himself, and another occasions use it for (what we might call) a prosecuting attorney.
I also indicated that the identification of a singular angel as 'the satan' only began developing in later Jewish thought, starting with Job and Zechariah; this would be the late exilic period, or perhaps the early Second Temple period. It is anachronistic to read the angel in Numbers 22 as the Satan, with a capital-s, as the narrative represented here has its origins much earlier in Israel's history. (See the fourth section below.)
2. Epithet 'of the LORD'
The figure in Numbers 22 is identified as 'the angel of the LORD', or more literally, 'the messenger of YHWH'. This label is also used in a variety of contexts throughout the Hebrew scriptures. There is a wide variety of opinions as to who this figure is, with suggestions including: any angelic figure who happened to be fulfilling a mission on God's behalf, a particular angelic figure who does this, a hypostasis of God (i.e. theophany), or a pre-incarnate Jesus (i.e. Christophany).
In any case, there is little question in any other context that the messenger of YHWH is just that: some personal entity who acts on God's behalf. This is evident in his designation as 'of YHWH'.
The title 'messenger of YHWH' is used quite often in the narrative that spans from Genesis to 2 Kings, and in every other passage beyond Numbers 22 we are never given the indication that the messenger acts 'on his own zealousness'.
3. In context with the rest of the sentence
The beginning of the sentence specifically says 'God's anger was kindled' against Balaam. It seems that, in context, the messenger of YHWH is acting as an 'opponent' against Balaam for precisely that reason. The immediate context does not seem to permit the interpretation that the messenger of YHWH was acting out of 'his own zealousness'.
4. Narrative discrepancy
An occasional problem readers have with the narrative in Numbers 22 is the apparent contradiction between verses 22.20-21, where God grants Balaam permission to go to Midian, and verse 22.22 (the verse under question), where the messenger of YHWH stands as an 'opponent' against Balaam because he was going to Midian. It may be that this contributes to the perception that the angel is acting 'zealously'.
However, it has been shown that Numbers 22 actually has stitched together two separate versions of Balaam's dealing with the Midianites, thus explaining the contradiction between Numbers 22.20-21 (God permits Balaam to go) and 22.22 (the angel 'opposes' Balaam from going).1,2
In the one version of Numbers 22:
- the Israelites arrive,
- upsetting Balak, king of Moab.
- Balak sends messengers to contact Balaam to curse Israel. However, God tells Balaam not to go. Balak's messengers come a second time, promising rewards.
- This time God permits Balaam to go to Balak, but forbids him from cursing Israel.
In the other version:
- the Israelites arrive,
- upsetting the people of Moab.
- The elders of Moab contact the elders of Midian, and together they approach Balaam, ready to pay him to curse Israel. Without question, Balaam sets out to curse Israel, but God sends his messenger to act as an 'opponent' to Balaam.
- The messenger reveals himself, and permits Balaam to continue so long as he does not curse Israel.
Separating the two accounts resolves the contradiction, and helps further indicate that the messenger of YHWH acts as an 'opponent' to Balaam specifically because God sent him to do so.
Conclusion
The 'satan' in this passage refers to an angel acting under God's direction, not out of his own zeal.
Footnotes
1 Michael D. Coogan (editor), The New Oxford Annotated Bible (2001), p.218-219 footnotes.
2 Julius A. Bewer, 'The Literary Problems of the Balaam Story in Numb., Chaps. 22-24', The American Journal of Theology 9.2 (1905), p. 238-262.