tempdb is used for temporary objects such as temp tables, table variables etc. it is also used for transfering large amounts of data between tables when the amount of memory is not enough to contain the transfer. tempdb will shrink and grow as the objects use it.
The Log file (ldf) is used to store transactions. Usually in the case a transaction needs to be reverted the .ldf is used to revert to the previous state.The .ldf will usually stay enlarged until a full backup of the .mdf is made. You will see the .ldf file grow as you do inserts, deletes, updates etc. all of those commands use logging and are therefore stored in the .ldf file.
Some commands, like TRUNCATE, use minimal logging so you may not see an increase in the .ldf file size.
The only safe way to shrink the log file is to create a full backup first (therefore stating that all the committed transactions are final) and that the transactions can be discarded.
As for the individual file growth you should note that some T-SQL commands affect .mdf and .ldf files. For more information you can lookup MSDN for T-SQL commands that use logging
(as a typical example the DELETE statement won't shrink the .mdf file and may increase the .ldf file, while TRUNCATE may shrink the .mdf file but will not increase the .ldf file due to the fact that the statement doesn't use logging as much)
The rule of thumb is never to shrink the .mdf file as this will mess up the index pages and will cripple the query performance. if you must shrink the .mdf file rebuilding all the indexes is recommended, and depending on the database size this may take anywhere from several minutes to a couple of hours.