Because the formula is like that only. So you multiple each item of first row of Matrix A with each item of first column of Matrix B and sum their product to get the total multiplied value.
So a[i][k] will give you first row items of Matrix 1 as k is increasing. So in that inner loop you will multiply a[0][0] * b[0][0]. Next for k=1, it will be a[0][1] * b[1][0]. And so on. So b is increasing by column and a is increasing by row.
You are storing that product in another matrix C.
For formula, refer -
Matrix Multiplication[
^].