It's not a bug, it's a feature ;) You probably have set a keyboard layout with so called "dead keys". Those keys are mostly not for printing characters themselves, but for modifying the following character. For example, if you press "~" followed by "e", you get "ẽ". This is a simple way to type so called "diacritic characters" that are combined of several glyphs like "é", "ñ", "ô", which are used in many languages. To print ~, `, ^ and others themselves, you can combine them with a space character, thus pressing for example "~" followed by the space key. Your solution, pressing the dead key twice, works as well, but is more complicated for the fingers in my opinion.
If you don't want to use the dead key functionality, you can, as you seem to already have, choose a keyboard layout that doesn't feature them.