Usage of words like will, would, may, might, can, could can be tricky. One should read the usage of these words again and again to understand in which context they fit the best. We often get confused between will and would. Though they are often used interchangeably, “would” is also used as the past tense of “will”.
For example: If I were you, I would not have gone there.
In this actually talking about past.
To understand it better, watch this Oxford video: