I am a high school student, and I recently did some research into image translation using cycle consistent generative networks (a branch of machine learning). Sadly, it seems I've made an error, and the network is learning to map images to themselves. It's still a very interesting question, and my algorithm doesn't work for a very interesting reason. But I'm worried I won't be able to do anything with this, in terms of getting it published in a small journal. Should I try something different, or should I publish my results?
Experiments that produce "interesting" results or which fail for an "interesting" reason may well be worthy of publication. But the nature of the publication is quite different from that of a "successful" bit of research.
Research is about knowledge. if you and others can learn something about what has occurred then it really hasn't failed in producing knowledge.
If the "interesting reason" you mention is interesting enough, and your explanation is clear and informative, then an editor may want to consider it.
But it is up to the editor and reviewers whether it actually makes it into a publication. But you learn nothing unless you submit it.
Note that "success" in research isn't measured by whether the results match your prior expectations. That would be a wast of time. Success depends on what is learned - especially if it can be generalized and extended.
Another way to say this is that in research we don't set out to "prove" something, but to "learn" something. Oddly enough this is true even in mathematics where we do prove things. But that proving stage comes after the research stage when we try to provide a demonstration of what we have learned.