Edit note: I've adopt an advice to use $\oplus$, which is equivalent to $+$ for vector. And I do distinguish it from that because a scalar, in normal case, can't be added to a vector.(special case)
Both $\hat i$ and $\hat j$ are unit vectors. Assume that: $$\vec A = A_{x} \hat{i} \oplus A_{y} \hat{j}\\ \vec B = B_{x} \hat{i} \oplus B_{y} \hat{j}\\$$
One of my book computes the dot product like this: $$Since \quad \hat i \cdot \hat i = \hat j \cdot \hat j = 1 \quad and \quad \hat i \cdot \hat j = 0\\ \begin{align} \vec A \cdot \vec B &=(A_{x} \hat{i} \oplus A_{y} \hat{j}) \cdot (B_{x} \hat{i} \oplus B_{y} \hat{j})\\ &= A_{x} \hat i \cdot B_{x} \hat i + A_{x} \hat i \cdot B_{y} \hat j\\ &\quad + A_{y}\hat j\cdot B_{x}\hat i+A_{y}\hat j\cdot B_{y}\hat j\\ &= A_{x} B_{x} + 0\\ &\quad + 0 + A_{y} B_{y}\\ &= A_{x} B_{x} + A_{y} B_{y}\\ \end{align}$$
Why the $\oplus$, which is for vector, in the parentheses become the $+$, which is for scalar? Is this related to axioms of vector space?
Edit2: Definition from my book:
We define $\vec A \cdot \vec B$ to be the magnitude of $\vec A$ multiplied by the component of $\vec B$ in the direction of $\vec A$. Expressed as an equation,
$\vec A \cdot \vec B = AB\cos{\phi} = |\vec A||\vec B|\cos{\phi}$
As above, expand the dot product for the two parentheses, and some terms become $0$,
$\vec A \cdot \vec B = A_{x}B_{x} + A_{y}B_{y} + A_{z}B_{z}$

If I understand the question correctly, you are asking about the following identity, which expresses the distributivity of the scalar product over vector addition:
$$\vec{v} \cdot (\vec{w} \oplus \vec{u}) = (\vec{v}\cdot\vec{w})+(\vec{v}\cdot\vec{u})$$
In the above equation, the operator $\oplus$ denotes vector addition, while the operator $+$ denotes scalar addition.
The reason the operator needs to change from vector addition to scalar addition is because the quantities in parentheses on the right-hand side of the equation are not vectors. They are scalars. Indeed if you tried to write $\oplus$ on the right-hand side the resulting expression would not make sense.
As for why it's true, in order to answer that question we would need to know how your book defines the dot product or inner product. In an abstract vector space, an inner product is by definition a pairing that takes two vectors and returns a scalar, and that satisfies various properties, of which the identity above is one. In more elementary treatments, the dot product may be specified by simply defining the dot products of the basis vectors $\hat{i}$ and $\hat{j}$ and extending that definition to the entire space via the distributive property above; in such a development, the distributive property may or may not be stated explicitly, but it really should be.