I don't have a source but I am fairly certain, Daenerys didn't know about Jon visiting Tyrion in the cell because of the later scene with her and Jon and her reaction to Jon asking mercy for Tyrion.
Then the question comes, why did Unsullied let Jon through. We saw in S08E05 that Tyrion managed to see Jaime after convincing the guarding Unsullied that he has a higher authority then the person they possibly got their orders from.
They have seen Jon by her side when she's standing on King's Landing steps and proclaiming her victory and further conquest. So they know he is a close ally to her.
They must have gotten their orders from Grey Worm or some other officers to guard the prisoner but when they see Jon, a close ally of Dany and a Commander of the Northern forces, they let him through because they know he has a higher authority and possibly Queen's confidence in the visit