Algebraically equality of two objects is often defined if they are "the same". We define this in different contexts, but mostly we define it together with the concept of an order relation. Some examples:
In set theory:
$$ A \subseteq B \land B \subseteq A \implies A=B$$
Since a set is defined by the elements it contains, if one set is contained in the other and vice versa, clearly they must contain the same elements. Here we see equality because a set is uniquely determined by its elements.
In ordered fields, using the trichotomy axiom ($\mathbb{Q}$ is an ordered field, not completely ordered though, $\mathbb{R}$ is):
$$ a\leq b \land b\leq a \implies a=b$$
In group theory: let $e$ be the identity element and $a$ an arbitray element in the group:
$$ e \cdot a = a \cdot e=a$$
This statements tells us that applying the identity elements does not do anything, it also does not matter from which side we apply it. All these examples only further support the idea we see equality as two things being "the same". We can even define the relation "=" for any two numbers, clearly:
$$ a=a$$
$$ a=b \implies b=a$$
$$ a=b \land b=c \implies a=c $$
So equality is an equivalence relation.
Another fun example there are equally as much even-sized subsets as odd-sized of a given set:
$$ 0=(1-1)^n = \sum_{k=0} ^n binom{n}{k} (-1)^n $$
Here the binomial tells us how many $k-sized$ subsets there are of a set $n$, we notice that all possible subsets are either even or odd by a partition of the natural numbers into these two sets. We can show there exists a bijection between the two so they have the same cardinality. We can split the sum up over odd and over even $k$ and notice that these two terms cancel, there must be the same amount of terms and thus there must be the same amount of subsets for all $n$. So there are equally as much off-subsets as even -subsets.
Surprisingly when two objects are "the same" in algebra, but have a different representation, we speak of the idea of an "isomorphism", which is also an interesting concept. This means we can identify both the structure and the elements uniquely. All very interesting ideas, definitely a nice question to think about, thank you!