To get a legend, you need to map a data variable to an aesthetic inside aes (like aes(colour=budget)). Here, since you're calculating different statistics for a single variable, we can create "dummy" aesthetic mappings that will generate a legend. In the example below, colour="Mean" and colour="Median" create the dummy mappings:
library(tidyverse)
# Fake data
set.seed(2)
data = data_frame(year=sample(2000:2010, 1e4, replace=TRUE),
budget=rnorm(1e4, 1e5, 1e4))
ggplot(data,aes(year,budget)) +
# geom_point(colour='blue') +
stat_summary(fun.y=mean,size=1,geom='line', aes(colour="Mean")) +
stat_summary(fun.y=median,size=1,geom='line', aes(colour="Median")) +
#coord_cartesian(ylim=c(0,2)) +
labs(title="Variation of Mean and Median of Budget vs. Time",
colour="") +
scale_colour_manual(values=c("tomato", "green"))

Another option would be to pre-summarise and shape the data to get "natural" aesthetic mappings:
data %>%
group_by(year) %>%
summarise_all(funs(Mean=mean, Median=median)) %>%
gather(key, value, -year) %>%
ggplot(aes(year, value, colour=key)) +
geom_line(size=1) +
labs(title="Variation of Mean and Median of Budget vs. Time",
colour="") +
scale_colour_manual(values=c("tomato", "green"))
The data summary step could also be done as follows:
data %>%
group_by(year) %>%
summarise(Mean=mean(budget),
Median=median(budget)) %>% ...