The orbit of Triton is what's known as a retrograde orbit. This means that the moon orbits in the complete opposite direction of the planet's rotation. Triton is the only large moon discovered in our solar system so far that does this.
Scientists and astronomers are not sure why this happens.
One theory is that the moon condensed this way from original material in the early solar system.
Another theory, and the most widely accepted theory, is that Triton was not originally a moon of Neptune, that it was formed elsewhere and was captured by Neptune's gravity. As a matter of fact, the surface features of Triton and the size of Triton are very similar to the dwarf planet Pluto. From time to time, Pluto does cross Neptune's path of orbit, so it is very likely that Triton was either a dwarf planet itself or a moon of Pluto before Neptune's gravity forced it to switch orbits.