Is it possible for someone to write his own Ethereum miner who would choose which transactions to execute according to own logic? Is there a mechanism for the network to discourage this type of behaviour?
It is possible, yes.
Miners can choose to include any transactions they want, and to censor any that they don't want in the final chain. On the other hand, as long as mining power is sufficiently decentralized, there is very little chance of a miner mining many blocks in a row, so the transaction should eventually be executed.
This is not a bad thing, though. For example, if I wanted to provide a service on Ethereum, but didn't want my customers to have to pay gas fees, I could mine, and choose to include in my block any transaction to my contract, even if
gasprice is zero.
Alternatively, I could accept gas fees in a currency other than Ether, by statically checking contracts to make sure they are guaranteed to pay me in some alternative token.