When you do something mechanically, you do it in a routine, automatic way, without much thought or feeling. If you have to get up unusually early in the morning, you might get dressed mechanically, still half-asleep.
People who are tired, stunned, or deeply upset will sometimes do things mechanically, working or performing tasks without emotion. When you act mechanically, you're machine-like. The adverb mechanically comes from the adjective mechanical, which since the 1600's has been used to describe people who "resemble machines." The Greek root is mekhane, "device."