In SQL language operation AND is executed before the operation OR because the precedence of operation AND is higher than operation OR. In the second query you use parentheses to explicitly set a different order. That’s why it returns a different result.
It’s always a good idea to use parentheses in complex expression to avoid confusion.
Query builder will not build it that way by selecting the or line on a different field. It will only put the “and” and “or” inside of the same parentheses when you use the" where" and “or” on the same field. Try using the formula tab on the where line of the Temp_A field instead, put your A condition then “or” and your Temp_B condition.