There has been a growing interest in deep learning-based prognostic and health management (PHM) for building end-to-end maintenance decision support systems, especially due to the rapid development of autonomous systems. However, the low trustworthiness of PHM hinders its applications in safety-critical assets when handling data from an unknown distribution that differs from the training dataset, referred to as the out-of-distribution (OOD) dataset. To bridge this gap, we propose an uncertainty-informed framework to diagnose faults and meanwhile detect the OOD dataset, enabling the capability of learning unknowns and achieving trustworthy fault diagnosis. Particularly, we develop a probabilistic Bayesian convolutional neural network (CNN) to quantify both epistemic and aleatory uncertainties in fault diagnosis. The fault diagnosis model flags the OOD dataset with large predictive uncertainty for expert intervention and is confident in providing predictions for the data within tolerable uncertainty. This results in trustworthy fault diagnosis and reduces the risk of erroneous decision-making, thus potentially avoiding undesirable consequences. The proposed framework is demonstrated by the fault diagnosis of bearings with three OOD datasets attributed to random number generation, an unknown fault mode, and four common sensor faults, respectively. The results show that the proposed framework is of particular advantage in tackling unknowns and enhancing the trustworthiness of fault diagnosis in safety-critical applications.