Cell is defeated by Gohan in the main timeline. In Future Trunks’ timeline, Trunks is the one who defeats him.