Why does appending a message to a key before hashing not guarantee integrity?
It depends on the hash function you're using, but some hash functions work like repeated block ciphers (SHA1 and MD5, for example).  The point is (as you've been told), an attacker can use the hash and continue appending data to generate a new and valid MAC.

That is, given $H(k||m)$, a valid MAC for $k||m$, an attacker can generate $H(k||m||m')$, a valid MAC for $k||m||m'$.  This is undesirable behavior.  We want to avoid the possibility of an attacker generating a valid MAC for any message, even if they don't know the key.  This is why it invalidates integrity, because now an attacker can make valid messages and MACs (with limitations) when they don't know the key.

See Length extension attacks.