if travelling at the speed of light would it take 1 million years to reach the andromeda galaxy
While it takes light approximately 2.54 million years to traverse the gulf of space between Earth and, for instance, the Andromeda Galaxy, it would take a much shorter amount of time from the point of view of a traveler at close to the speed of light due to the effects of time dilation; the time experienced by the traveler depending both on velocity (anything less than the speed of light) and distance traveled (length contraction). Intergalactic travel for humans is therefore possible, in theory, from the point of view of the traveller.
Intergalactic travel