While freehubs on modern high-end hubs tend to be easily serviced and can be detached for inspection with regular tools, I found that at least lower end Shimano parts are more troublesome in that regard.
For example, to remove a freehub from my Shimano Deore XT hub required a specialized Shimano tool which turned out to be an allen key of either 12 mm or 12.7 mm size, do not remember exactly. This is not something everyone has at home. Different hubs may need other exotic tools.
Once you manage to remove the hub body, you will need to make sure that all ratcheting pawls and their springs are not blocked by dirt. Be careful as these little springs can jump and fly away in an unknown direction quite easily.
If it is the normal wear that made things malfunction, then you should look if a replacement freehub can be bought separately. Sometimes it is the case, sometimes your only option would be to buy a complete identical rear hub and transplant the freehub from it. Or, as long as you have a whole new hub on your hands, replace it altogether. Any way, knowing the hub's model number is essential.
For example, here's an exploded view of FH-RM30.

The body fixing bolt part 13 is clearly detachable. It is only a question what size of a hex key is needed.
Here's a view on how it is done:
.