Philadelphia, for most people. Not because it’s closer, it isn’t, but because that’s where the flights are.
Atlantic City (ACY) is right there, a short drive from the AC boardwalk and not far from Ocean City or Brigantine. The catch is how few flights it has. Service there changes alot, and lately its mostly a few low cost airlines flying to Florida and the Carolinas. If one of those happens to leave from near you, great, take it.
Philadelphia (PHL) is a big hub with flights from almost everywhere. From the airport it’s about an hour to Atlantic City and longer to the beach towns further south, depending on traffic. On a summer Friday afternoon the Atlantic City Expressway can get slow, so try to land earlier in the day.
No rental car? You can still get from Philly to AC by train or bus. It takes longer than driving. With just a carry-on though, it’s easy enough.
If you’re headed to Cape May or the towns around it, the math shifts a bit, since even Atlantic City is about an hour away.