Dumbledore trusted Snape because of his deep remorse over the death of Lily Potter, whom Snape loved unconditionally. Snape's decision to protect Harry, despite his hatred for James Potter, convinced Dumbledore of his loyalty. Snape's true allegiance was one of the biggest twists in the series.