It is not weird, nor it is even related with C or your program.
Can somebody explain why is the \t behaving like this?
It all depends on where the TAB is being processed. The behavior of TAB processing is to advance the cursor to the next tab stop, and tab stop columns are set someplace, application specific or terminal emulator specific.
Also note that TAB stops can be used at specific columns and not at specific interval like 4 or 8 columns like in most editors.
If you are using windows terminal there is a settings.json file where you can set them.
In Linux you have the tabs command, that is often installed in Windows when you install with git or if you install gcc. Many of my Windows machines have this tabs command and reports the version --- tabs -V --- as 6.4
Under Windows the default is to have VIRTUAL TERMINAL PROCESSING on console, and in this case you can also use VT100 commands to set and reset tab stops.