Yes. There is a difference between freehubs that take a through axle versus 10mm QR axle. Some through axle hubs can be converted to QR by means of different end caps, however the internals are still the same as a through axle set up. One cannot convert a 10mm QR hub to use a through axle, however.
I Googled your rim model and a couple popular bike parts sale sites had this rim paired with a SRAM 406 hub. See the links below. This is an 8-9-10 speed, HG freehub. An 11 speed Shimano MTB cassette (like your M5100, 11-51t, cassette) will fit on these. It's possible you have a different brand of HG freehub. As someone mentioned, you have to match the freehub body to the rear hub. Basically what differs between free hub bodies of different manufacturers are how the body is secured to the hub and the position of the pawls.
It's best to remove the problem freehub body and see what you have and then match it with available bodies online. Or take it to your LBS. Freehub bodies can be tough to remove. It will take a 10, 12 or 15mm hex head (aka Allen key) depending on manufacturer. In addition, (again, depending on hub manufacturer) the appropriate size hex wrench may enter the hub on approach to the freehub body's lock nut sometimes from the left, non drive side, sometimes from the right, drive side. Either way it is a normal, right hand thread you're dealing with but the direction of approach will require the wrench to be turned the correct way to loosen. There's lots of gotcha's with these things.