Change active collection
In Blender 2.80, I've had some success with something simpler that previous @johnzero7's solution :

collection = bpy.data.collections.new('My Collection')
bpy.context.scene.collection.children.link(collection)

# NOTE the use of 'collection.name' to account for potential automatic renaming
layer_collection = bpy.context.view_layer.layer_collection.children[collection.name]
bpy.context.view_layer.active_layer_collection = layer_collection