Chat rooms are for discussions in real-time, but the chats aren’t archived for future reference.
Moreover, the chat rooms are discussions on a topic without any categorization of the question itself. So if there is a chat room for PHP programming, one can discuss anything on PHP without any definition of sub-topic.
On the other hand, chat rooms are more like Facebook groups where a topic is in chronological order, and no one cares about the content shared in the past.
Whereas in forums, the topics and discussions are arranged under a forum and sub-forum along with an option to search and reference older topics.