Actually, the brunt of the confusion is not the variable, but the '=' sign, which in mathematics means 'is equal to', while in a programming language means 'assign to'. This indirectly changes the semantics of the variable within the statement, and confuses people.
This is why `x + 5 = 10` makes sense in mathematics, but not in a programming language.
"In mathematics, the equals sign can be used as a simple statement of fact in a specific case (x = 2), or to create definitions (let x = 2), conditional statements (if x = 2, then...), or to express a universal equivalence (x + 1)2 = x2 + 2x + 1."
In most programming languages, the equals sign is reserved only for definition.
If you wanted to be explicit about this in maths, you can use := and I think that notation would solve a lot of beginner and early programmer problems.
This is why `x + 5 = 10` makes sense in mathematics, but not in a programming language.