Found at least one way to replicate this always:
When you are in an active chat, go to Teams (channels) area or for example Activity. When you return to Chat, you will notice you return to the same chat you were in earlier but the text box is not active anymore, and the first letter you type, like H from Hi will indeed take you to the first chat on your list that starts with H, so for example a chat with Heidi. It is easy to miss you jumped to a different chat, and thus you accidentally type your message to Heidi.
This is of course an information security and privacy risk, Microsoft is basically creating Data breaches to customers all over the world. People might accidentally share sensitive info about health, personal data, or company financial / legal etc. details. It is a major risk and I am very surprised this has not been fixed already.
One thing I do nowadays, is after any large Teams meeting with multiple participans, I leave the chat immediately after the meeting from Options - Leave Chat. That way I prevent myself from sharing sensitive information to large audiences by accident.