Chatham is an ~1.5 hour drive from Boston with heavier traffic on Friday evenings & Sunday afternoons. Please plan accordingly when planning any airline travel.
Boston Logan Airport
Logan is the closest major airport to Cape Cod. From Logan, we recommend renting a car from the airport and driving. However, Ubers will make the trek for about ~$130.
Cape Cod is served by a very small airport in Hyannis. Cape Air partners with Jetblue, United and American. There are daily flights from NYC and Boston, but you can originate in another city and connect through one of those. Fares can be expensive but there good deals to be found. Once at the airport in Hyannis you can take a cab, Uber, or rent a car to get to your accomodation.
Plymouth Brockton Bus
If you are arriving at Boston Logan Airport or South Station and don't plan to rent a car, the best option to get to Cape Cod is the PB Bus, getting off at the Barnstable/Burger King exit. From Barnstable, Ubers are available to Chatham (~$50)
Once on Cape Cod, public transit is pretty non-existant.