The Kazhdan-Lusztig polynomial of a matroid was introduced by Elias, Proudfoot and Wakefield, whose properties need to be further explored. In this paper we prove that the Kazhdan-Lusztig polynomials of fan matroids coincide with Motzkin polynomials, which was recently conjectured by Gedeon. As a byproduct, we determine the Kazhdan-Lusztig polynomials of graphic matroids of squares of paths. We further obtain explicit formulas of the Kazhdan-Lusztig polynomials of wheel matroids and whirl matroids. We prove the real-rootedness of the Kazhdan-Lusztig polynomials of these matroids, which provides positive evidence for a conjecture due to Gedeon, Proudfoot and Young. Based on the results on the Kazhdan-Lusztig polynomials, we also determine the Z-polynomials of fan matroids, wheel matroids and whirl matroids, and prove their real-rootedness, which provides further evidence in support of a conjecture of Proudfoot, Xu, and Young.