For polymer M, you will spot that there are NHCO (amide) links between each monomer. As such, that tells you one end of the molecule should be a carboxylic acid and the other should be a primary amine (hence the other end can’t be an acyl chloride, as acyl chlorides of acids with amine groups aren’t stable). To confuse you, they’ve gone and removed the carbonyl end of the monomer on the left and instead included the carbonyl from a third monomer in the amide link furthest to the right. This is a perfectly valid thing to do in order to show complete amide links, but imo it’s weird.
The middle of the molecule must be the -CH2-CH(CH3)-CH2- as there is one of these in each full monomer shown. This leads to the conclusion that the monomer is NH2CH2CH(CH3)CH2COOH. Using naming comventions, we can deduce that this is 4-amino-3-methylbutanoic acid.
I'm super confused as to how the monomer actually has more than two carbons in the main chain, and how this was identified at all (stuck on polymer M)
you need to distinguish between addition and condensation polymers. M is an amide (condensation) so the monomer could be any length. Learn to split the polymer up i.e. add water back on to get the original amine and carboxylic acid. It's actually really easy if you make it easy. Addition polymers are different as you're right, it should be two carbons every repeat in the main chain.