As I understand it he was struggling to give meaning to Einstein's energy formula E =√((mc²)² + p²c²) when p in QM has to be an operator. He found he could do it if he replaced single variable by matrices, implying there was a family of 4 entities rather than just the one treated by Schrödinger's original equation. Spin apparently fell out of this, as it fitted with Pauli's attempts to accommodate spin which implied pairs of entities instead of one, but the meaning, if any, of the other 2 remained to be established. Until it was worked out that they would, if real, be antiparticle counterparts of the entity.