When I play in tournaments, I do not know when it is legal to stop chess notation. Also, if my opponent stops notating, is it okay for me to stop notating as well?
According to the FIDE Laws of Chess:
Article 8: The recording of the moves
8.4 If a player has less than five minutes left on his clock at some stage in a period and does not have additional time of 30 seconds or more added with each move, then for the remainder of the period he is not obliged to meet the requirements of Article 8.1.
Article 8.1 is the one that states that players need to keep record of the moves and what the players must and must not write to the scoresheet.
When I play in tournaments, I do not know when it is legal to stop chess notation.
You may stop notating when your clock shows less than five minutes and you get no increment or increment of less than 30 seconds. You have to start again at the start of the next period, that is, when more time is added to your clock (not the increment but for example at move 40).
Also, if my opponent stops notating, is it okay for me to stop notating as well?
It makes no difference whether your opponent has to write the moves or not.
It's important to note that USCF rules differ from FIDE rules in this situation.
According to USCF rules 15B and 15C, both players may stop taking notation if either player has less than 5 minutes remaining. However, if a player is not taking notation, they lose the right to claim a draw by the 50 move rule or the 3 move rule, and lose the right to claim a win on time if it is a non-sudden-death time control (because they cannot prove how many moves they have played.)
According to rule 15F, the players must resume taking notation if they meet a time control which results in both players again having over 5 minutes left. In this case, they're also required to make "all efforts" to fill in all missing notation before they make another move. If both players need to update their scoresheets, the clock should be stopped while they do so, but if only one player needs to do so, his clock runs while he does this. If filling in the notation is impossible, they can construct a diagram of the position.