C172 Flight Instructor reported taking evasive action to avoid reported helicopter traffic resulted in an airspace violation and NMAC.
Synopsis
C172 Flight Instructor reported taking evasive action to avoid reported helicopter traffic resulted in an airspace violation and NMAC.
Narrative
I was departing ZZZ Airport when ATC advised there was a helicopter a few hundred feet below and about a mile off my left wind and I reported traffic in sights. ATC then contacted the helicopter off my right wing and informed him that I was off his right side and he acknowledged and reported he had me in sight. Shortly after that the helicopter began a climbing right turn towards my direction. The helicopter went out of my field of view due to me being in the right seat; I asked my student if he had visual contact with the helicopter but he did not give me a clear answer and started looking around frantically. My ADS-B was showing me the aircraft was directly below me and at an extremely close distance. I then decided to take control of the aircraft from my student and perform evasive maneuvers to avoid collision. I applied full power and began a steep climb before lowering my left wing to establish visual contact with the helicopter. I saw the aircraft directly below me at a very close range still climbing alongside me. I continued my climbing turn away from the helicopter and once I was clear I checked my altimeter and I was at 3;100 ft.; 100 ft. into the overlying class Bravo airspace beginning at 3;000. I quickly reduced throttle and returned to 2;800 ft. I believe without the evasive maneuvers I performed it could have resulted in collision. I am not aware of the helicopters tail number but it happened approximately 4nm south east of ZZZ airport on the edge of ZZZ airspace. I believe due to the high traffic area the helicopter may have not seen us and referred to another Cessna resulting in him beginning his turning climb directly into our path. I wouldn't imagine the pilot knowingly would have done that.
Source: NASA Aviation Safety Reporting System (public domain). Reports are voluntary submissions and are not verified by NASA.