By the rules as written, no.
Normally, in any given turn a beast master ranger's animal companion only does what it is told by its master on that turn, and there is no provision within the rules for the companion following one instruction over multiple turns, like say chasing down a foe or continuing to attack a specific target. If, on a given turn, you do not use your action to command the companion, it simply takes the Dodge action instead, regardless of any previous commands it may have been given.
As the Beast Master description states:
The beast obeys your commands as best as it can. It takes its turn on your initiative. On your turn, you can verbally command the beast where to move (no action required by you). You can use your action to verbally command it to take the Attack, Dash, Disengage, or Help action. If you don't issue a command, the beast takes the Dodge action. Once you have the Extra Attack feature, you can make one weapon attack yourself when you command the beast to take the Attack action.
Since it was originally the case that if the master was incapacitated the beast would, by RAW, simply sit in place and take the dodge action for the rest of time, errata to the PHB did add a paragraph about how the companion behaves if its master is incapacitated or absent:
If you are incapacitated or absent, the beast acts on its own, focusing on protecting you and itself. The beast never requires your command to use its reaction, such as when making an opportunity attack.
So if you are not able to command the beast - either because you are yourself incapacitated or because you are simply not there - the companion will revert to defensive behaviour to protect you and itself. It will attack things that threaten it or you, and if you aren't a concern it might even run away from danger to protect itself, but it won't take initiative to chase after or attack non-threatening targets.
If the companion has moved so far that it can no longer receive orders from you, it will only act to defend itself, and I would likely rule that it turns around and tries to find you again; but this is a very unlikely situation, since the beast even only moves when instructed to on a given turn, so it won't chase after an enemy for multiple turns without you being near enough to instruct it to keep doing so on each turn.
Yes, this is somewhat underwhelming. There is a reason the Ranger was identified by the D&D team as being an unsatisfying and weak character option.