Whenever your play MTGA, the game itself saves various details about what is happening to a text file. This file can then be used to reconstruct what is happening as you play. This is the "log file", and MTGA saves it with the file name "Player.log".
As you play, the Untapped.gg Companion watches this log file in real time and reacts to new lines that appear. There are dozens of different types of lines that may appear in the file, indicating when matches start or end, which deck you queue into the game with, which cards you draw and more.
Importantly, the log file is generated freely by the game, and will never contain data that your game does not know about. This means there is no way to cheat, as your game (and in turn the log file) only knows about cards that have been revealed to you and you know about.
The rest is all up to us: Once we know which cards your deck had at the start of the game, and which cards you've drawn, we can calculate which cards remain in your deck. We can take the results of your matches and create the time line on your profile for you to look at any time.