It came up today that i and j are used for variables in loops. The reason for that likely has to do with Fortran. As this piece (Fortran – Implicit variable types | fortran Tutorial) explains:
When Fortran was originally developed memory was at a premium. Variables and procedure names could have a maximum of 6 characters, and variables were often implicitly typed. This means that the first letter of the variable name determines its type. variables beginning with i, j, …, n are integer everything else (a, b, …, h, and o, p, …, z) are real
I used to program in older versions of Fortran (in the early 80s) and we automatically used i and j for variables and loops. Likely it carried over into other languages too. For example, I have an early edition of The C Programming Language book and they use i for some of their loops (page 20).