Java memory management is based on garbage collection. This means that the available memory will be used up to a large degree (although I don’t expect it to be used up to 99%), and then is ‘cleaned up’.
5 GBs of RAM is excessive for most use cases. Can you share more about the setup? Are you running any plugins? Do you have any customizations applied?
Are you seeing functional issues? Are “Out of Memory” exceptions being logged, or does Openfire shut down unexpectedly?
To diagnose what is in your memory, you’ll need to create a memory dump of the Java process, and analyze that. You can use standard Java tooling for that.