Snape leaves it on Dumbledore's (kind of) orders. This is shown in his memories during the Chapter "The Prince's Tale".
And now Snape stood again in the headmaster’s study as Phineas
Nigellus came hurrying into his portrait. “Headmaster! They are
camping in the Forest of Dean! The Mudblood – ”
“Do not use that
word!”
“ – the Granger girl, then, mentioned the place as she opened
her bag and I heard her!”
“Good. Very good!” cried the portrait of Dumbledore behind the
headmaster’s chair. “Now, Severus, the sword! Do not forget that it
must be taken under conditions of need and valor – and he must not
know that you give it! If Voldemort should read Harry’s mind and see
you acting for him – ”
“I know,” said Snape curtly. He approached the
portrait of Dumbledore and pulled at its side. It swung forward,
revealing a hidden cavity behind it from which he took the sword of
Gryffindor.
“And you still aren’t going to tell me why it’s so
important to give Potter the sword?” said Snape as he swung a
traveling cloak over his robes.
“No, I don’t think so,” said
Dumbledore’s portrait. “He will know what to do with it. And Severus,
be very careful, they may not take kindly to your appearance after
George Weasley’s mishap – ”
Snape turned at the door. “Don’t worry,
Dumbledore,” he said coolly. “I have a plan…”