Definitely sounds like it could be a hardware issue. These Airs are relatively easy to get open. I would certainly pop the bottom off and have a look (unplug the battery of course, before you start monkeying with anything).
Your issue could lie in a few places. On the M1 model, the keyboard plugs into a small board around the underside of the trackpad. And a little arm of a flex cable connects that board into the trackpad cable (technically Apple calls it the IPD cable for this reason), which then goes to the logic board for the system. If you're lucky you'll just have to reseat one or both of these cables. You can see what I mean here
I will also mention it is not an uncommon place to get liquid damage. It's much more typical for there to be an issue with the trackpad, but even if you don't think you've ever spilled, it's a spot that's fairly susceptible to even a small amount.