Amazon Interview Question

How does a hashmap work internally? What is the purpose of using a hashmap instead of an array?