You don't give any info on why or how this may have happened. Has the bike been left laying on its drive side? Has the bike been dropped on its drive side? Has a stick jumped into the rear wheel? etc etc etc If you want good suggestions give good information.
You don't give any info on what kind of frame or rear derailleur so it is a bit hard to offer useful suggestions but the hanger is the first to check.
First thing to do is to check the rear derailleur hanger alignment.
If it is aligned then next is to check the derailleur itself. You want to make sure the derailleur itself has not been bent or the bushings, springs, etc. are not worn to the point where it no longer holds the derailleur in the correct position.
Next is to check the limit screws...honestly unless someone has been screwing around with them they are correctly set or have been incorrectly set for a long time. If the hanger is bent or the derailleur is bent it may look like the limit screws are out but that is wrong and why you always start with the hanger alignment then derailleur.
If the above are all ok then check the derailleur cable for stretch. shift into the smallest rear cog and lightly tug on the cable. If it is loose, floppy, it is likely stretched and needs retensioning to bring it to the correct tension to shift correctly.
There are Youtube videos showing how to adjust a derailleur and it is far easier to watch than try by reading how.
Lastly, if you don't know what you're doing and just start adjusting you are likely to waste a lot of time and wind up nowhere but with a still mis adjusted derailleur...bring it to a shop.
You also need the correct tool for the hanger...you can eyeball it but generally it only works kinda sorta when it is badly misaligned and you have done it enough times to know what you are seeing...the tool is not cheap and you can likely get it checked, aligned and the derailleur adjusted at a shop for far less...but it is a good tool to have if you like to work on bikes and work on a lot of them.
I'll say it again...if you don't give enough info you will never get good advice and/or suggestions.
Good luck