That is an air admittance valve, AAV. They are used when a vent to the atmosphere is not practical. Some places do not allow them as they can go bad. They are designed to let air in, so P-traps are not siphoned dry yet keep sewer gases from coming into the house. They do go bad at time as they have moving parts. Any plumbing or big box store or Amazon has them. Just make sure you get the same size. It is probably an 1 1/2", but it could be a 2".