She was given the hammer as a weapon in order to strengthen her tomboyish nature (note that this is also the reason why she is a playable character in the game). The Piko Piko Hammer made its first appearance in Sonic the Fighters, in which Amy used it as a part of her combat moves.
The phrase 'piko-piko' is an onomatopoeia for the chirping sound that these hammers make when struck (which can also be heard in several games when Amy attacks). The Piko Piko Hammer was originally based on a popular Japanese children's toy of the same name.