Will getting a B in math [linear algebra at a college] as a prospective math major hurt my chances at top schools?

The problem is that community college classes are viewed as being much, much less rigorous than those at 4 yr colleges, and even less so than those at T20 schools. So an A in a community college class doesn’t show limitations, since it’s the highest grade you can get there. But a B in a comm coll class DOES show possible limitations.

However, most high school students don’t take linear algebra. I’m assuming that if you were, you’ve already taken Calc BC and multivariable Calc, and I presume you’ve done well in those. In light of that, I don’t think that a B in linear algebra, even at the comm coll, will hurt your applications. Apply everywhere you want to, and of course make sure that you include academic and financial safeties. The good news is that you many schools have excellent math departments. You can achieve your career goals by majoring in math at your state flagship, as well as at a T20 school with a strong math dep’t.