Building off the answer from here: using bold in mtext on string coming from vector element
In order to tell bquote to evaluate a variable, instead of simply printing it as text, you need to wrap the term in .(), which causes it to instead evaluate it in the specified environment (given by the where argument).
temp <- 'a'
e <- new.env()
assign('temp','b',envir = e)
plot(2,5)
legend("topleft",
legend = c(as.expression(
bquote(bold(temp))), # No .(), `temp` is text
bquote(bold(.(temp))), # eval `temp` in parent.env
bquote(bold(.(temp)), where = e))) # eval `temp` in envir "e"

The help for ?bquote mentions this:
bquote quotes its argument except that terms wrapped in .() are evaluated in the specified where environment
legend("topleft", legend = parse(text = c(sprintf('bold(%s)', temp), temp)))