If a graph $G$ has a 2-factor it means it is a 2-regular subgraph that contains all vertices of $G$. Isn't it a hamiltonian cycle? because it is 2-regular so it is a cycle and it contains all vertices of the graph.
A $2$-factor might not be connected; it might consist of multiple cycles that, together, include all the vertices. The standard example is the Petersen graph:
- It has no Hamiltonian cycle, which has a number of proofs with varying amounts of casework.
- However, it does have a $2$-factor: take the "outside" $5$-cycle together with the "inside" $5$-cycle, for example.