Because they went to the same Timeline. Again, Cell merely appeared earlier in the exact same Timeline Trunks did, as stated himself. He merely went earlier within it, as I have pointed out from his own words, the evidence from the anime and manga's diagrams, and the fact your logic could not apply, since he would not be able to live/travel to a timeline altered by Trunks killing Frieza and Cold since the original Future is that of Goku doing so, meaning he chose a Timeline Trunks already traveled to. Whilst yes this may create plotholes and may not make sense, this is precisely as the events occurred.