Difficult to say, but I would very much believe this to be a software issue. Your main memory is quite low but that should also not lock your system, just slow it down.
I think 20.04 is the current long term support version from Ubuntu. Are you sure it completely locks up? If you hit CTRL+ALT+F1 - F4 it doesn't bring you to the system console? Otherwise a software component might be crashing.
A reinstall might work, could perhaps be a driver issue that causes the freeze. Difficult to analyze.
Reinstalling is a lot of work but might help. If you don't care for LTS versions, perhaps try a newer one. But that is all based on guesses, maybe ask in a forum specifically for Ubuntu and tell them about the specific hardware you are using. Perhaps someone has similar experiences.