Chubbies or Patagonia baggies are the gold standard.
Mesh liners from either of those two brands stay put, don’t bunch up, and breathe better than the cheap fabric you find at big-box stores. If you want something cheaper, literally anything with a liner made of polyester mesh (not that clammy nylon) will do.
The real trick is fit: swim trunks without liners are a different conversation (then you need separate underwear). With a built-in liner, you want a snug but not tight compression—think boxer briefs, not spandex. Chubbies have a little more room in the leg, Patagonia baggies are a bit more tailored. Both dry fast and don’t chafe.
Avoid trunks with mesh that feels like sandpaper or liners that are sewn in with a single seam—those will ride up. Also avoid anything with a “built-in brief” that’s basically a diaper. You’ll know when you try them on
