How do other galaxies move relative to earth?
Not a simple question, but an interesting one.
Firstly, all galaxies are rotating and up to a point, the further from the centre a star is, the slower it will rotate, so they 'twist up' over time.
Secondly, within our local group (30 or so galaxies, but many more dwarf galaxies) that are gravitationally bound together and rotate about their common centre of mass, somewhere between the Milky Way and M31, the Andromeda galaxy.
Thirdly, beyond this distance scale, galaxies are generally moving apart with the speed of recession proportional to the distance. This is the expansion of space due to the Big Bang. It doesn't occur on smaller scales because 'local' gravity has overcome it.
There are further effects, but this answer is probably long enough for the moment. As I said, not simple!