Dananjaya, bowling with a remodelled action after being reported for a suspect action last year, trapped BJ Watling for one at the stroke of tea to register his fourth five-wicket haul in six matches.
New Zealand were 179 for five, having recovered from 71-3 at lunch as Taylor and Henry Nicholls put on 100 runs to lead the tourists' fightback.
Taylor was unbeaten on 70 after New Zealand elected to bat first at the start of the two-match series.
Dananjaya, who took three wickets in the first session including skipper Kane Williamson's prized scalp for nought, trapped Nicholls lbw for 42 to break the fourth-wicket century stand.
Taylor handled pace and spin with aplomb as he registered his 31st Test fifty.
Earlier, openers Jeet Raval and Tom Latham put on 64 runs before Dananjaya struck on a pitch that is already offering big turn.
Latham was the first to go after being caught behind for 30 as Dananjaya got the left-handed batsman to poke at a delivery that was turning away.
Williamson fell three balls later when he flicked one straight into the hands of his opposite number Dimuth Karunaratne at short midwicket.
In the last over before lunch, Raval failed to pick a googly and was caught at first slip by Dhananjaya de Silva for 33.
Both Sri Lanka and New Zealand are playing their first match of the World Test Championship, which has nine top teams competing for supremacy in the five-day format.