Can I ask a middle school teacher for a letter of recommendation for undergrad? Would it not look good? This teacher saw a lot in me, and it would be awesome to have him as a reference. How many letters do I need?
You can ask, but it would be ill-advised.
You simply aren’t the same person now (hopefully!) as you were in middle school. Unless you have continued interacting with him in ECs or some other significant way it generally isn’t recommended.
10-11th grades are generally preferred for recommenders. Some schools will not require any, many will require 1-3.
My son’s guidance counselor recommended the following strategy in a somewhat similar situation. Do not use the middle school teacher for your teacher reference. Instead, have that teacher send a paragraph or two to the guidance counselor, and the guidance counselor can refer to what the teacher said about you in the guidance counselor’s report.