Hash function and Digital Encryption Algorithm
One reason ECDSA (the elliptic curve variant of DSA used by Bitcoin) first hashes data is to make forging signatures harder. Consider the first two steps in ECDSA:


  
  Calculate $e = \text{HASH}(m)$, where $\text{HASH}$ is a cryptographic hash function, such as SHA-2.
  Let $z$ be the $L_n$ leftmost bits of $e$, where $L_n$is the bit length of the group order $n$.
  


Suppose instead that $z$ is the $L_n$ leftmost bits of the message $m$ instead. In that case the resulting signature is a valid signature for any message $m$ with the same $L_n$ leftmost bits. In the case of ECDSA in bitcoin $L_n = 256$, or 32 bytes (which would be 32 characters in ASCII encoding). This gives a lot of possible ways to forge a message as only 32 characters need to be the same for the signature to be valid. 

The way to avoid this would be use all the bits of the message in the signature, but with arbitrarily large messages this can cause huge performance issues as we're now performing public key crypto on potentially much larger amounts of data.

So the idea of using the hash function is to take an arbitrarily large amount of data and transform it into a much smaller amount of data before performing any of the expensive operations on it. But we also need this to happen in a way such that it is hard, given message $m_1$, to find another message $m_2$ that produces the same hash output. Otherwise we again have the case that the signature for $m_1$ is also valid for $m_2$. The property of cryptographic hash functions (which SHA-2 falls under) known as (second) pre-image resistance gives us this property.