This also happened to me, but I am yet unsure as to what causes this behaviour. At first I thought it was exactly because of what Riptorch mentioned, but then I noticed that the "stray" vessel had its waypoint set not only one jump back, but actually more jumps, going back to the gravity well in which it was produced. I think it is somehow related to the fact that the ship, when it came out of production, didn't actually make it to the shipyard's rally point before being ordered together with its newly auto-joined fleet to jump away. I say this because I noticed that it is always the last ship that came out of a shipyard that exhibits this behaviour, and of course the fact that it always wants to return to its "home" gravity well as soon as it has no orders queued. I find myself dealing with this bug or whatever it is pretty often, and found no way around it. Not even leaving the fleet then rejoining it seems to cancel that move order. The only way I managed to actually get rid of it was sending the ship back through all the jumps needed to get back "home", or downright scuttling it.