There are two kinds of accounts, Externally Owned Accounts (EOA) and contacts.
Both types have an address. An EOA has a private key for signing transactions. A contract has no private key and cannot sign a transaction. It has code that tells it what is must do and a storage namespace where it can store state data.
All transactions are kicked off by someone or something signing a transaction. That transaction may be addressed to a contract. In that case, it will usually contain additional data to indicate the function to invoke and arguments to pass in.
When such a transaction is mined, the code in the contract function is executed by each node to evaluate how that transaction updates the contract's internal state.
Hope it helps.