The | operator has higher precedence than ==, so you’re doing "hello" | greeting - this is fixed by adding parentheses to the expression: (greeting == "hello") | (greeting == "Hello")
This is parsed as greeting == ("hello" | greeting) == "Hello", since | has higher precedence than ==. You would have to write (greeting == "hello") | (greeting == "Hello") to use |.
As @lmiq commented, what you want is greeting == "hello" || greeting == "Hello": || is “logical or”, which is usually what is employed in boolean expressions (and has lower precedence than ==). | is a “bitwise or” operation, and is usually for bit arithmetic.
(They also differ in that || is short-circuiting, which is typically what you want in logical operations, and | is not.)