The first question you need to ask is what license is your code under? If, for example, you published your code under the GPL, then someone taking your code and publishing results obtained with it is entirely within their rights. It may be bad academic style to not say where they got the code from, but there is nothing that would objectionable from a legal perspective about the fact. You might be upset that they didn't acknowledge you, but you likely have little recourse -- lots of people publish research done with widely used software packages like PyTorch without referencing where they had it from, and the academic community appears to be ok with that. (Whether that's how it should be is a separate question not to be litigated here.)
On the other hand, if you didn't attach a license to your code, then it remains yours whether or not the code is available on github. If you can prove that they used your code, then you could presumably take legal action against them, though that is a matter from which the journal in question will likely want to stay about as far away as possible. The difficult thing to show in this legal argument is that indeed the person in question did use your code, and not just their own implementation of a similar algorithm. If you have good reasons to believe that they did indeed use your code, then you will get a chance to test your belief during the discovery phase of any trial -- but you already get the idea: This is likely going to get expensive.
What would happen to that other person: If your pockets are deep enough to actually win a law suit, then that other person's employer is likely going to be interested in following up because their employee used a piece of software illegally. If your software was available under a license that allowed the other person to use it, then people can have differing opinions on whether or not they were required to cite you, and nothing will likely happen.
Short story short: If you really really don't want anyone to use your software, you have two options: (i) Use github, make your repositories public, mark everything as proprietary software, and set aside a few $10k for potential law suits; (ii) don't use github, or make your github repositories private.